safe_syslog_handler package

Submodules

safe_syslog_handler.handlers module

class safe_syslog_handler.handlers.SafeSysLogHandler(address=('localhost', 514), facility=1, socktype=None)[source]

Bases: logging.handlers.SysLogHandler

A handler class that inherits from logging.handlers.SyslogHandler.

If using socket.SOCK_STREAM as the sockettype and it’s not using a unixsocket, then this handler will try to restore the socket’s connection if target go down.

It will supress any [Errno 32] Broken pipe exception that might occour during the emission of the message, and instead will try to reconect the socket.

If any socket.error exception occours during this reconnection, then this error is handled by logging.handlers.SyslogHandler. That is, it will try to traceback the exception into sys.stderr.

handleError(record)[source]
is_socketstream_and_not_unixsocket()[source]
recreate_socket()[source]
retry_socketstream_connection(record)[source]

Module contents