module Syslog: Syslog
Options for opening syslog
type
opt =
| |
PID |
| |
CONS |
| |
ODELAY |
| |
NDELAY |
| |
NOWAIT |
| |
PERROR |
Types of syslog messages (facilities)
type
fac =
| |
KERN |
| |
USER |
| |
MAIL |
| |
DAEMON |
| |
AUTH |
| |
SYSLOG |
| |
LPR |
| |
NEWS |
| |
UUCP |
| |
CRON |
| |
AUTHPRIV |
| |
FTP |
| |
LOCAL0 |
| |
LOCAL1 |
| |
LOCAL2 |
| |
LOCAL3 |
| |
LOCAL4 |
| |
LOCAL5 |
| |
LOCAL6 |
| |
LOCAL7 |
Types of and functions for logging levels
type
lev =
| |
EMERG |
| |
ALERT |
| |
CRIT |
| |
ERR |
| |
WARNING |
| |
NOTICE |
| |
INFO |
| |
DEBUG |
val all_levs : lev array
all_levs
array of all logging levels sorted in ascending order.
val all_str_levs : string array
all_str_levs
array of all logging levels as strings sorted in
ascending order.
val compare_lev : lev -> lev -> int
compare_lev lev1 lev2
compares logging levels lev1
and lev2
.
val string_of_lev : lev -> string
string_of_lev lev
converts a level lev
to a string.
val lev_of_string : string -> lev
lev_of_string str
converts string str
to a level.
Raises Failure
if level does not exist.
val setlogmask : ?levs:lev list ->
?from_lev:lev -> ?to_lev:lev -> unit -> unit
setlogmask ?levs ?from_lev ?to_lev ()
sets the log mask. All levels
in levs
will be allowed, and additionally all ranging from
from_lev
to to_lev
(inclusive).
levs
: default = none
from_lev
: default = DEBUG
to_lev
: default = EMERG
Logging functions
val openlog : ?id:string -> ?opt:opt list -> ?fac:fac -> unit -> unit
openlog ?id ?opt ?fac ()
opens a connection to the system logger
(possibly delayed) using prefixed identifier
id
, options
opt
,
and faculty
fac
.
WARNING: this function leaks the id
argument, if provided. No way
around that if syslog is called in a multi-threaded environment!
Therefore it shouldn't be called too often. What for, anyway?
id
: default = Sys.argv.(0)
opt
: default = ODELAY
fac
: default =
USER
Calling openlog
before syslog
is optional. If you forget, syslog will
do it for you with the defaults.
val syslog : ?fac:fac -> ?lev:lev -> string -> unit
syslog ?fac ?lev str
logs message str
using syslog with faculty
fac
at level lev
.
fac
: default = as passed by openlog
lev
: default = INFO
val esyslog : ?fac:fac -> ?lev:lev -> string -> unit
esyslog ?fac ?lev str
same as
Syslog.syslog
, but also prints to
stderr
.
val syslogf : ?fac:fac ->
?lev:lev -> ('b, unit, string, unit) Pervasives.format4 -> 'b
syslog_printf ?fac ?lev fmt
same as
Syslog.syslog
, but allows
printf
-style specification of the message using
fmt
.
val esyslogf : ?fac:fac ->
?lev:lev -> ('b, unit, string, unit) Pervasives.format4 -> 'b
esyslog_printf ?fac ?lev fmt
same as Syslog.syslog_printf
,
but also prints to stderr
.
val closelog : unit -> unit