Up

module Log

: sig

Logger

Log levels

#
type log_level =
# | FATAL
# | ERROR
# | WARN
# | INFO
# | DEBUG
#
val string_of_level : log_level -> string
#
val level_of_string : string -> log_level

Setup

#
val set_log_level : log_level -> unit
#
val get_log_level : unit -> log_level
#
val set_output : Pervasives.out_channel -> unit

Printf-like logging primitives

#
module type S = sig
#
val log : log_level -> ('a, Pervasives.out_channel, unit, unit) Pervasives.format4 -> 'a
#
val fatal : ('a, Pervasives.out_channel, unit, unit) Pervasives.format4 -> 'a
#
val error : ('a, Pervasives.out_channel, unit, unit) Pervasives.format4 -> 'a
#
val warn : ('a, Pervasives.out_channel, unit, unit) Pervasives.format4 -> 'a
#
val info : ('a, Pervasives.out_channel, unit, unit) Pervasives.format4 -> 'a
#
val debug : ('a, Pervasives.out_channel, unit, unit) Pervasives.format4 -> 'a
end
include S

Coloring of log levels (optional)

#
val color_on : unit -> unit
#
val color_off : unit -> unit
#
val set_color_mapping : (log_level -> string) -> unit

Functor interface (optional)

#
module type SECTION = sig

Signature for the functor parameters.

#
val section : string

Section name.

end
#
module Make : functor (Section : SECTION) -> S

This module aims to be used on the first line of each module: module Log = Log.Make(struct let section = "module-name" end)

end