Module Topkg.Log

module Log: sig .. end
Topkg log.


Reporting levels


type level = 
| App
| Error
| Warning
| Info
| Debug
The type for reporting levels.
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 Topkg.Log.level_of_string.
val level_of_string : string -> (level option, [ `Msg of string ]) Result.result
level_of_string s parses the representation of Topkg.Log.level_to_string from s.

Log functions


type 'a msgf = (?header:string -> ('a, Format.formatter, unit) Pervasives.format -> 'a) ->
unit
val msg : level -> 'a msgf -> 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.
val on_error_msg : ?level:level -> use:(unit -> 'a) -> 'a Topkg.result -> 'a
on_error_msg ~level r is:

Monitoring


val err_count : unit -> int
err_count () is the number of messages logged with level Error.
val warn_count : unit -> int
warn_count () is the number of messages logged with level Warning.