Topkg.Log
Topkg log.
val level : unit -> level option
level ()
is the current reporting level.
val set_level : level option -> unit
set_level l
sets the current reporting level to l
.
val level_to_string : level option -> string
level_to_string l
converts l
to an unspecified human-readable US-ASCII string that can be parsed back by level_of_string
.
level_of_string s
parses the representation of level_to_string
from s
.
type 'a msgf = (?header:string -> ('a, Format.formatter, unit) format -> 'a) -> unit
msg l (fun m -> m fmt ...)
logs with level l
a message formatted with fmt
.
val app : 'a msgf -> unit
app
is msg App
.
val err : 'a msgf -> unit
err
is msg Error
.
val warn : 'a msgf -> unit
err
is msg Warning
.
val info : 'a msgf -> unit
err
is msg Info
.
val debug : 'a msgf -> unit
err
is msg Debug
.
on_error_msg ~level r
is:
v
if r = Ok v
use e
if r = Error (`Msg e)
. As a side effect e
is logged with level level
(defaults to Error
).