package gapi-ocaml
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=b84b680528a5e050014103a8e7a60a5d43efd5fefc3f838310bd46769775ab48
md5=8ee26acf1f6c6f5e24c7b57fa070a0a2
doc/gapi-ocaml.netsys-local/Netlog/index.html
Module Netlog
Source
Basic logging facility
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.
The log levels (syslog-like)
channel_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,
The variable containing the current logger function. Defaults to channel_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.
The level names indexed by weight
format_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 ofNetdate
`ISO
: ISO-8601 format
The current timestamp formatter
Example: Change the format of timestamps to ISO with a precision of milliseconds:
Netlog.current_formatter := Netlog.format_timestamp `ISO 3