package octez-libs
Syslog primitives based on the syslog(3)
function.
See RFC 3164 for more information.
val facility_to_string : facility -> string
val facility_of_string_opt : string -> facility option
Converts from string. Possible string values are: "auth", "authpriv", "cron", "daemon", "ftp", "kernel", "local0", "local1",
"local2", "local3", "local4", "local5", "local6", "local7", "lpr", "mail",
"news", "syslog", "user", "uucp", "ntp", "security", "console"
type t = {
mutable fd : Lwt_unix.file_descr;
tag : string;
facility : facility;
with_pid : bool;
path : string;
}
A syslog logger
Creates a syslog logger.
create tag ?path ?with_pid facility
opens the socket or the file path
and returns a syslog logger. Messages logged through this logger with syslog
are prepended with tag
and send to facility
.
path
default value is, if exists, in this order:"dev/log"
,"/var/run/syslog"
,""
- If
with_pid
istrue
(the defaultfalse
), include the caller's PID in each message.
val format_message :
?max_buflen:int ->
?timestamp:float ->
tag:string ->
facility:facility ->
with_pid:bool ->
Tezos_event_logging.Internal_event.level ->
string ->
string
format_message ?max_buflen logger level message
formats the given message
depending on logger
and level
max_buflen
is the maximum length of the complete message after which text is replaced by...
. Default to1024
due to original standard.timestamp
is the timestamp to display. UsesUnix.time
if not provided.
val syslog :
?max_buflen:int ->
?timestamp:float ->
t ->
Tezos_event_logging.Internal_event.level ->
string ->
unit Lwt.t
syslog ?max_buflen logger level message
formats message
(using format_msg
) and sends the result to the logger
file descriptor with the appropriate level
.