summaryrefslogtreecommitdiff
path: root/2025/ocaml/bin
diff options
context:
space:
mode:
Diffstat (limited to '2025/ocaml/bin')
-rw-r--r--2025/ocaml/bin/dune4
-rw-r--r--2025/ocaml/bin/main.ml15
2 files changed, 17 insertions, 2 deletions
diff --git a/2025/ocaml/bin/dune b/2025/ocaml/bin/dune
index 49a288c..3903f3b 100644
--- a/2025/ocaml/bin/dune
+++ b/2025/ocaml/bin/dune
@@ -5,4 +5,6 @@
domain
application
infrastructure
- presentation))
+ presentation
+ logs
+ logs.fmt))
diff --git a/2025/ocaml/bin/main.ml b/2025/ocaml/bin/main.ml
index f34d5ef..cbfe6d2 100644
--- a/2025/ocaml/bin/main.ml
+++ b/2025/ocaml/bin/main.ml
@@ -1,3 +1,16 @@
-let main () = Presentation.Cli.run ()
+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 ())