package cohttp-lwt-unix

  1. Overview
  2. Docs

Module Cohttp_lwt_unix.DebugSource

Debugging output for Cohttp Unix

Sourceval default_reporter : Logs.reporter

default_reporter provides a simple reporter that sends the logging output to stderr. For example, the code below enables logging at level level to stderr, using coloured output if possible.

  Fmt_tty.setup_std_outputs ();
  Logs.set_level ~all:true (Some level);
  Logs.set_reporter Debug.default_reporter
Sourceval activate_debug : unit -> unit

activate_debug enables debugging output that will be sent to standard error.

Sourceval debug_active : unit -> bool

debug_active returns true if activate_debug has been called and false otherwise

Selectively disable cohttp logging

It is possible to selectively disable cohttp internal logginb by filtering over the various modules logs names as follows.

  (* Set log level v for all loggers, this does also affect cohttp internal loggers *)
  Logs.set_level ~all:true level;
  (* Disable all cohttp-lwt and cohttp-lwt-unix logs *)
  List.iter (fun src ->
      match Logs.Src.name src with
      | "cohttp.lwt.io" | "cohttp.lwt.server" -> Logs.Src.set_level src None
      | _ -> ())
  @@ Logs.Src.list ()
OCaml

Innovation. Community. Security.