# Module Syslog

    module Syslog: sig .. end

Syslog routines

These are loosely based on the unix syslog(3) function and relatives.

    type facility = [ `LOG_AUTH
           | `LOG_AUTHPRIV
           | `LOG_CONSOLE
           | `LOG_CRON
           | `LOG_DAEMON
           | `LOG_FTP
           | `LOG_KERN
           | `LOG_LOCAL0
           | `LOG_LOCAL1
           | `LOG_LOCAL2
           | `LOG_LOCAL3
           | `LOG_LOCAL4
           | `LOG_LOCAL5
           | `LOG_LOCAL6
           | `LOG_LOCAL7
           | `LOG_LPR
           | `LOG_MAIL
           | `LOG_NEWS
           | `LOG_NTP
           | `LOG_SECURITY
           | `LOG_SYSLOG
           | `LOG_USER
           | `LOG_UUCP ]

The assorted logging facilities. The default is ``LOG_USER`. You can set a new default with openlog, or give a specific facility per syslog call.

    type flag = [ `LOG_CONS | `LOG_PERROR | `LOG_PID ]

Flags to pass to openlog. ``LOG_CONS` isn't implemented yet. LOG_NDELAY is mandatory and implied

    type level = [ `LOG_ALERT
           | `LOG_CRIT
           | `LOG_DEBUG
           | `LOG_EMERG
           | `LOG_ERR
           | `LOG_INFO
           | `LOG_NOTICE
           | `LOG_WARNING ]

The priority of the error.

    type t

the type of a syslog connection

    val facility_of_string : string -> facility

given a string descibing a facility, return the facility. The strings consist of the name of the facility with the LOG_ chopped off. They are not case sensitive.

- Raises `Syslog_error` when given an invalid facility

    val openlog : ?logpath:string ->
           ?facility:facility -> ?flags:flag list -> string -> t

openlog ?(logpath=AUTODETECTED) ?(facility=`LOG_USER) ?(flags=[]) program_name, similar to openlog(3)

- Raises `Syslog_error` on error

    val syslog : ?fac:facility -> t -> level -> string -> unit

Same as syslog(3), except there's no formats.

- Raises `Syslog_error` on error (very rare)

    val closelog : t -> unit

Close the log.

- Raises `Syslog_error` on error