SyslogBackend#

SyslogBackend implements mw::log::detail::Backend for Linux. SyslogRecorderFactory selects it when the log mode contains kSystem. TextRecorder uses it in the same way as SlogBackend on QNX.

SyslogBackend stores LogRecord objects in a CircularAllocator. ReserveSlot() acquires a slot and FlushSlot() sends its contents to syslog. No log data leaves the process before FlushSlot() runs.

FlushSlot() maps LogLevel to a syslog(3) priority. It sends the application ID, context ID, and payload in one formatted call. kOff and out-of-range levels are ignored.

Syslog::openlog() runs once during construction. The Syslog object seam enables host tests without a running syslog daemon.

MW_LOG_RECORDERS

The sequence diagram shows a log call from stream construction to syslog(3).

SyslogBackendSequenceDesign MW_LOG_RECORDERS

The sequence below shows a single log call from LogStream construction through to the syslog(3) call made when the stream is destroyed and the slot is flushed:

SyslogBackendSequenceDesign