Mavryk_base_unix.Syslog
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"
, ""
with_pid
is true
(the default false
), include the caller's PID in each message.val format_message :
?max_buflen:int ->
?timestamp:float ->
tag:string ->
facility:facility ->
with_pid:bool ->
Mavryk_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 to 1024
due to original standard.timestamp
is the timestamp to display. Uses Unix.time
if not provided.val syslog :
?max_buflen:int ->
?timestamp:float ->
t ->
Mavryk_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
.
val close : t -> unit Lwt.t
close logger
closes the logger's file-descriptor. The logger cannot be used after a call to this function. A call to syslog logger ...
would result in a raised exception of kind Unix.Unix_error
.