Cmdliner terms for ergonomic logging configuration
at main 26 lines 829 B view raw
1(*--------------------------------------------------------------------------- 2 Copyright (c) 2025 Thomas Gazagnaire. All rights reserved. 3 SPDX-License-Identifier: MIT 4 ---------------------------------------------------------------------------*) 5 6(** Test CLI with JSON disabled. *) 7 8open Cmdliner 9 10let src = Logs.Src.create "test" ~doc:"Test source" 11 12module Log = (val Logs.src_log src : Logs.LOG) 13 14let run () = 15 Log.err (fun m -> m "error message"); 16 Log.warn (fun m -> m "warning message"); 17 Log.info (fun m -> m "info message") 18 19let suite = ("cli_no_json", [ Alcotest.test_case "noop" `Quick ignore ]) 20 21let cmd = 22 let doc = "Test CLI for vlog with JSON disabled" in 23 let info = Cmd.info "test-cli-no-json" ~doc in 24 Cmd.v info Term.(const run $ Vlog.setup ~json_reporter:None "test") 25 26let () = exit (Cmd.eval cmd)