module Log:sig..end
Topkg log.
type level =
| |
App |
| |
Error |
| |
Warning |
| |
Info |
| |
Debug |
The type for reporting levels.
val level : unit -> level optionlevel () is the current reporting level.
val set_level : level option -> unitset_level l sets the current reporting level to l.
val level_to_string : level option -> stringlevel_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 ]) Topkg.rlevel_of_string s parses the representation of Topkg.Log.level_to_string
from s.
type'amsgf =(?header:string -> ('a, Stdlib.Format.formatter, unit) Stdlib.format -> 'a) ->
unit
val msg : level -> 'a msgf -> unitmsg l (fun m -> m fmt ...) logs with level l a message formatted
with fmt.
val app : 'a msgf -> unitapp is msg App.
val err : 'a msgf -> uniterr is msg Error.
val warn : 'a msgf -> uniterr is msg Warning.
val info : 'a msgf -> uniterr is msg Info.
val debug : 'a msgf -> uniterr is msg Debug.
val on_error_msg : ?level:level -> use:(unit -> 'a) -> 'a Topkg.result -> 'aon_error_msg ~level r is:
v if r = Ok vuse e if r = Error (`Msg e). As a side effect e is logged
with level level (defaults to Error).val err_count : unit -> interr_count () is the number of messages logged with level Error.
val warn_count : unit -> intwarn_count () is the number of messages logged with level Warning.