summaryrefslogtreecommitdiff
path: root/2025/ocaml/bin/main.ml
diff options
context:
space:
mode:
Diffstat (limited to '2025/ocaml/bin/main.ml')
-rw-r--r--2025/ocaml/bin/main.ml15
1 files changed, 14 insertions, 1 deletions
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 ())