module Netlog:sig..end
The purpose of this module is to define a mutable logging function
which ensures to be always pointing to a valid logging implementation.
By default, the function prints the messages to stderr, prepended
by a timestamp. In Netplex context, the implementation is changed so
that the Netplex logger is used instead (see Netplex_log), and
the log and logf functions below have the same effect as
the counterparts in Netplex_cenv with the same name.
typelevel =[ `Alert | `Crit | `Debug | `Emerg | `Err | `Info | `Notice | `Warning ]
typelogger =level -> string -> unit
val channel_logger : Pervasives.out_channel -> level -> loggerchannel_logger ch lev: Prints all messages with a level of lev
and higher to the channel ch. The output buffer is flushed after
each message,val current_logger : logger Pervasives.refchannel_logger stderr `Debug at program startup.
Assign something else to this variable in order to change the
log destination or the log level.
Note that the function Netplex_main.run modifies current_logger
so log messages are forwarded to the Netplex logger. It is then the
Netplex framework that determines log destination and level.
val log : level -> string -> unitval logf : level -> ('a, unit, string, unit) Pervasives.format4 -> 'aprintfval level_weight : level -> intval level_of_string : string -> levelval string_of_level : level -> stringval level_names : string arraytypeformat =[ `ISO | `Std ]
val format_timestamp : format -> int -> float * int -> stringformat_timestamp fmt digits (seconds,nanos): Formats the timestamp
(seconds,nanos) and returns the string. Pass in digits the number
of digits for fractional seconds.
`Std: This is the "%c" format of Netdate`ISO: ISO-8601 formatval current_formatter : (float * int -> string) Pervasives.refExample: Change the format of timestamps to ISO with a precision of milliseconds:
Netlog.current_formatter := Netlog.format_timestamp `ISO 3
module Debug:sig..end