package tezos-base

  1. Overview
  2. Docs

Syslog primitives based on the syslog(3) function.

See RFC 3164 for more information.

type facility =
  1. | Auth
  2. | Authpriv
  3. | Cron
  4. | Daemon
  5. | FTP
  6. | Kernel
  7. | Local0
  8. | Local1
  9. | Local2
  10. | Local3
  11. | Local4
  12. | Local5
  13. | Local6
  14. | Local7
  15. | LPR
  16. | Mail
  17. | News
  18. | Syslog
  19. | User
  20. | UUCP
  21. | NTP
  22. | Security
  23. | Console

The various kinds of syslog output.

exception Syslog_error of string
type t

A syslog logger

val create : tag:string -> ?path:string -> ?with_pid:bool -> facility -> t Lwt.t

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", ""
  • If with_pid is true (the default false), include the caller's PID in each message.
val format_message : ?max_buflen:int -> tag:string -> facility:facility -> with_pid:bool -> Tezos_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.
val syslog : ?max_buflen:int -> t -> Tezos_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.

OCaml

Innovation. Community. Security.