Module Cohttp_lwt_unix.Debug

Debugging output for Cohttp Unix

val 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
val activate_debug : unit -> unit

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

val 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 ()