package syslog

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Syslog routines

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

type facility = [
  1. | `LOG_KERN
  2. | `LOG_USER
  3. | `LOG_MAIL
  4. | `LOG_DAEMON
  5. | `LOG_AUTH
  6. | `LOG_SYSLOG
  7. | `LOG_LPR
  8. | `LOG_NEWS
  9. | `LOG_UUCP
  10. | `LOG_CRON
  11. | `LOG_AUTHPRIV
  12. | `LOG_FTP
  13. | `LOG_NTP
  14. | `LOG_SECURITY
  15. | `LOG_CONSOLE
  16. | `LOG_LOCAL0
  17. | `LOG_LOCAL1
  18. | `LOG_LOCAL2
  19. | `LOG_LOCAL3
  20. | `LOG_LOCAL4
  21. | `LOG_LOCAL5
  22. | `LOG_LOCAL6
  23. | `LOG_LOCAL7
]

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 = [
  1. | `LOG_CONS
  2. | `LOG_PERROR
  3. | `LOG_PID
]

Flags to pass to openlog. LOG_NDELAY is mandatory and implied

type level = [
  1. | `LOG_EMERG
  2. | `LOG_ALERT
  3. | `LOG_CRIT
  4. | `LOG_ERR
  5. | `LOG_WARNING
  6. | `LOG_NOTICE
  7. | `LOG_INFO
  8. | `LOG_DEBUG
]

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=[]) tag Similar to openlog(3). You MUST define tag as 32 ABNF alphanumeric characters maximum.

  • 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

OCaml

Innovation. Community. Security.