package dolog

  1. Overview
  2. Docs

Logger

Log levels
type log_level =
  1. | FATAL
  2. | ERROR
  3. | WARN
  4. | INFO
  5. | 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 : out_channel -> unit
val set_prefix : string -> unit
val clear_prefix : unit -> unit
val set_prefix_builder : (log_level -> string) -> unit
val get_prefix_builder : unit -> log_level -> string
val short_prefix_builder : log_level -> string

Ready-to-use short timestamp builder

Printf-like logging primitives
val log : log_level -> ('a, out_channel, unit, unit) format4 -> 'a
val fatal : ('a, out_channel, unit) format -> 'a
val error : ('a, out_channel, unit) format -> 'a
val warn : ('a, out_channel, unit) format -> 'a
val info : ('a, out_channel, unit) format -> 'a
val debug : ('a, out_channel, unit) format -> 'a
Coloring of log levels (optional)
type color =
  1. | Black
  2. | Red
  3. | Green
  4. | Yellow
  5. | Blue
  6. | Magenta
  7. | Cyan
  8. | White
  9. | Default
val color_on : unit -> unit
val color_off : unit -> unit
val set_color_mapping : (log_level -> color) -> unit
OCaml

Innovation. Community. Security.