module Lwt_log:sig
..end
Lwt_log_core
with Unix features.
It adds:
include Lwt_log_core
val render : buffer:Buffer.t ->
template:template -> section:section -> level:level -> message:string -> unit
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
time"$(date) $(name)[$(pid)]: $(message)"
"$(date).$(milliseconds) $(name)[$(pid)]: $(message)"
"$(date): $(loc-file): $(loc-line): $(loc-column): $(message)"
typesyslog_facility =
[ `Auth
| `Authpriv
| `Console
| `Cron
| `Daemon
| `FTP
| `Kernel
| `LPR
| `Local0
| `Local1
| `Local2
| `Local3
| `Local4
| `Local5
| `Local6
| `Local7
| `NTP
| `News
| `Security
| `Syslog
| `UUCP
| `User ]
val syslog : ?template:template ->
?paths:string list -> facility:syslog_facility -> unit -> logger
syslog ?template ?paths ~facility ()
creates an logger
which send message to the system logger.template
: defaults to "$(date) $(name)[$(pid)]: $(section): $(message)"
paths
: is a list of path to try for the syslogd socket. It
default to ["/dev/log"; "/var/run/log"]
.val file : ?template:template ->
?mode:[ `Append | `Truncate ] ->
?perm:Unix.file_perm -> file_name:string -> unit -> logger Lwt.t
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 filetemplate
: defaults to "$(date): $(section): $(message)"
mode
: defaults to `Append
val channel : ?template:template ->
close_mode:[ `Close | `Keep ] ->
channel:Lwt_io.output_channel -> unit -> logger
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.
template
: defaults to "$(name): $(section): $(message)"