Module Syslog


module Syslog: sig .. end
Syslog Interface
Author(s): Markus Mottl


Options for opening syslog



type opt =
| PID (*Syslog Interface*)
| CONS (*Syslog Interface*)
| ODELAY (*Syslog Interface*)
| NDELAY (*Syslog Interface*)
| NOWAIT (*Syslog Interface*)
| PERROR (*Syslog Interface*)

type fac =
| KERN (*Syslog Interface*)
| USER (*Syslog Interface*)
| MAIL (*Syslog Interface*)
| DAEMON (*Syslog Interface*)
| AUTH (*Syslog Interface*)
| SYSLOG (*Syslog Interface*)
| LPR (*Syslog Interface*)
| NEWS (*Syslog Interface*)
| UUCP (*Syslog Interface*)
| CRON (*Syslog Interface*)
| AUTHPRIV (*Syslog Interface*)
| FTP (*Syslog Interface*)
| LOCAL0 (*Syslog Interface*)
| LOCAL1 (*Syslog Interface*)
| LOCAL2 (*Syslog Interface*)
| LOCAL3 (*Syslog Interface*)
| LOCAL4 (*Syslog Interface*)
| LOCAL5 (*Syslog Interface*)
| LOCAL6 (*Syslog Interface*)
| LOCAL7 (*Syslog Interface*)

type lev =
| EMERG (*Syslog Interface*)
| ALERT (*Syslog Interface*)
| CRIT (*Syslog Interface*)
| ERR (*Syslog Interface*)
| WARNING (*Syslog Interface*)
| NOTICE (*Syslog Interface*)
| INFO (*Syslog Interface*)
| DEBUG (*Syslog Interface*)
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 memory! 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 = []
fac : default = USER
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 syslog_printf : ?fac:fac ->
?lev:lev -> ('a, unit, string, unit) Pervasives.format4 -> 'a
syslog_printf ?fac ?lev fmt same as Syslog.syslog, but allows printf-style specification of the message using fmt.
val esyslog_printf : ?fac:fac ->
?lev:lev -> ('a, unit, string, unit) Pervasives.format4 -> 'a
esyslog_printf ?fac ?lev fmt same as Syslog.syslog_printf, but also prints to stderr.
val closelog : unit -> unit
closelog () closes the connection to the syslog daemon.