Module Tracelog

Tracelog is the main logging module for codex.

Instanciate a new logger with Tracelog.Make:

  module Log = Tracelog.Make(struct let category = "MyCategory" end)

You can then use logging functions Log.error, Log.warning, Log.notice, Log.info, and Log.debug (in increasing verbosity level). Additionally, Log.fatal prints and exits. Finally, Log.trace can be used to trace entry/return into a function.

For a short tutorial, see Tracelog Debugging in Codex.

You can change the global level using set_verbosity_level (set to `Notice by default).

type 'a printf = ('a, Stdlib.Format.formatter, unit) Stdlib.format -> 'a

A function that behaves like printf.

type 'a log = 'a printf -> unit

A log message takes a printf function and print with it. This avoid the need to parse and evaluate arguments when we do not log.

val set_log_binary_trace : bool -> unit
val set_verbosity_level : [ `Error | `Warning | `Notice | `Info | `Debug ] -> unit

Verbosity level, from less to most verbose. Default is to display everything below `Warning. Feedback levels are from less to more verbose (normal levels are from 0 to 2, but you can pass bigger numbers.)

val get_verbosity_level : unit -> [ `Error | `Warning | `Notice | `Info | `Debug ]
type location = ..
val reset_location_stack : unit -> unit

reset the location stack, USE ONLY IF YOU KNOW WHAT YOU ARE DOING

val current_location : unit -> location option

The innermost location set by trace.

val current_location_stack : unit -> location list

The current stack of locations set by trace.

val set_pp_location_stack : (Stdlib.Format.formatter -> location list -> unit) -> unit

If we have location information, it will be printed using this function.

module type S = sig ... end
module Make (Category : sig ... end) : S

Standard functor: verbosity level is controlled by set_verbosity_level.

module MakeDebug (Category : sig ... end) : S

This is useful when developping and debugging a specific module: we can enable debugging forthis module by replacing the Make call by MakeDebug.

module MakeSilent (Category : sig ... end) : S

Completely silence this debug output.

module Dummy : S

Outputs nothing, usefull for developpers who want to hide a domain by simply replacing the usual Log = Make(...) by Log = Dummy