:mod:`syslog` -- access to the system log ========================================= .. module:: syslog :synopsis: provides 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(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. .. method:: 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. .. method:: 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 ~~~~~~~~~ .. data:: Syslog.LEVEL_INFO 'info' .. data:: Syslog.LEVEL_WARN 'warning' .. data:: Syslog.LEVEL_ERR 'danger'