From 6d8fb621d1e93b83786890d6d9cb6f0d8defa8ae Mon Sep 17 00:00:00 2001 From: DJ O'Leary Date: Fri, 26 Jun 2026 18:04:09 +0200 Subject: refactor!: invert repo directory structure now is language first --- ocaml/bin/dune | 11 +++++++++++ ocaml/bin/main.ml | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 ocaml/bin/dune create mode 100644 ocaml/bin/main.ml (limited to 'ocaml/bin') diff --git a/ocaml/bin/dune b/ocaml/bin/dune new file mode 100644 index 0000000..0f6768d --- /dev/null +++ b/ocaml/bin/dune @@ -0,0 +1,11 @@ +(executable + (public_name advent_of_code) + (name main) + (libraries + domain + application + infrastructure + presentation + logs + logs.fmt) + (modes byte exe)) diff --git a/ocaml/bin/main.ml b/ocaml/bin/main.ml new file mode 100644 index 0000000..cbfe6d2 --- /dev/null +++ b/ocaml/bin/main.ml @@ -0,0 +1,16 @@ +let env_log_level = + match Sys.getenv_opt "LOG_LEVEL" with + | None -> + Some Logs.Warning + | Some lvl -> ( + match Logs.level_of_string lvl with Error _ -> None | Ok v -> v ) + +let main () = + let log_level = env_log_level in + Logs.set_level log_level ; + Logs.set_reporter (Logs_fmt.reporter ()) ; + Logs.info (fun m -> + m "Started application with LOG_LEVEL=%s" (Logs.level_to_string log_level) ) ; + Presentation.Cli.run () + +let () = if !Sys.interactive then () else exit (main ()) -- cgit v1.2.3