Logging facility
This module provides functions to deal with logging. It extends [root:Lwt_log_core] with Unix features. It adds:
Same as Lwt_log_core.render, except that the template may also contain the following variables:
date
which will be replaced with the current datemilliseconds
which will be replaced by the fractionnal part of the current unix
timeFor example:
"$(date) $(name)[$(pid)]: $(message)"
"$(date).$(milliseconds) $(name)[$(pid)]: $(message)"
"$(date): $(loc-file): $(loc-line): $(loc-column): $(message)"
Syslog facility. Look at the SYSLOG(3) man page for a description of syslog facilities
syslog ?template ?paths ~facility ()
creates an logger
which send message to the system logger.
["/dev/log"; "/var/run/log"]
.
"$(date) $(name)[$(pid)]: $(section): $(message)"
desf_file ?template ?mode ?perm ~file_name ()
creates an
logger which will write messages to file_name
.
mode = `Truncate
then the file is truncated and previous
contents will be lost.mode = `Append
, new messages will be appended at the end
of the file`Append
"$(date): $(section): $(message)"
channel ?template ~close_mode ~channel ()
creates a logger
from a channel.
If close_mode = `Close
then channel
is closed when the
logger is closed, otherwise it is left open.
"$(name): $(section): $(message)"