Module sloggers::syslog

source ·
Expand description

Logger that sends logs to local syslog daemon. Unix-like platforms only. Uses the POSIX syslog API.

§Concurrency issues

POSIX doesn’t support opening more than one connection to syslogd at a time. Although it is safe to construct more than one logger using this module at the same time, some of the settings for syslog loggers will be overwritten by the settings for additional syslog loggers created later.

For this reason, the following rules should be followed:

  • Libraries should not use this module or otherwise call openlog unless specifically told to do so by the main application.
  • An application that uses this module should not cause openlog to be called from anywhere else.
  • An application should not use this module to construct more than one Logger at the same time, except when constructing a new Logger that is to replace an old one (for instance, if the application is reloading its configuration files and reinitializing its logging pipeline).

Failure to abide by these rules may result in closelog being called at the wrong time. This will cause openlog settings (application name, syslog facility, and some flags) to be reset, and there may be a delay in processing the next log message after that (because the connection to the syslog server, if applicable, must be reopened).

Modules§

  • Ways to format syslog messages with structured data.

Structs§

  • A logger builder which builds loggers that send log records to a syslog server.
  • The configuration of SyslogBuilder.
  • Indicates that <Facility as FromStr>::from_str was called with an unknown facility name.

Enums§

  • A syslog facility. Conversions are provided to and from c_int.