syslog – access to the system log

Note

A global instance of the Syslog class is instantiated in this module. When used by the custom code, this instance must be used. Do not create additional instances of the Syslog class

Import the syslog instance like this:

from syslog import syslogd

Classes

class syslog.Syslog(sz=16)

Creates a system logger. sz is the maximum length of the log queue.

The log is kept in the RAM, which is very limited. Therefore, the log should be emptied on a regular basis. The builtin web server does it automatically.

..method:: fpush(data, level=LEVEL_WARN)

Appends a new entry to the log. This is not a coroutine. This function should only be used before the asyncio loop is created.

push(data, level=LEVEL_WARN)
Async

Append a new entry to the log. This is a coroutine. This function internally uses a Lock to protect the log queue from race conditions.

pull()
Async

Returns all the entries in the log as a list. The log is emptied. This is a coroutine. This function internally uses a Lock to protect the log queue from race conditions.

Constants

Syslog.LEVEL_INFO

‘info’

Syslog.LEVEL_WARN

‘warning’

Syslog.LEVEL_ERR

‘danger’