logging.handlers.SysLogHandler.encodePriority()

encodePriority(facility, priority) Encodes the facility and priority into an integer. You can pass in strings or integers - if strings are passed, internal mapping dictionaries are used to convert them to integers. The symbolic LOG_ values are defined in SysLogHandler and mirror the values defined in the sys/syslog.h header file. Priorities Name (string) Symbolic value alert LOG_ALERT crit or critical LOG_CRIT debug LOG_DEBUG emerg or panic LOG_EMERG err or error LOG_ERR info LOG_INFO

logging.handlers.SysLogHandler.emit()

emit(record) The record is formatted, and then sent to the syslog server. If exception information is present, it is not sent to the server. Changed in version 3.2.1: (See: issue 12168.) In earlier versions, the message sent to the syslog daemons was always terminated with a NUL byte, because early versions of these daemons expected a NUL terminated message - even though it’s not in the relevant specification (RFC 5424). More recent versions of these daemons don’t expect the NUL byte but st

logging.handlers.SysLogHandler.close()

close() Closes the socket to the remote host.

logging.handlers.SysLogHandler

class logging.handlers.SysLogHandler(address=('localhost', SYSLOG_UDP_PORT), facility=LOG_USER, socktype=socket.SOCK_DGRAM) Returns a new instance of the SysLogHandler class intended to communicate with a remote Unix machine whose address is given by address in the form of a (host, port) tuple. If address is not specified, ('localhost', 514) is used. The address is used to open a socket. An alternative to providing a (host, port) tuple is providing an address as a string, for example ‘/dev/l

logging.handlers.SocketHandler.send()

send(packet) Send a pickled string packet to the socket. This function allows for partial sends which can happen when the network is busy.

logging.handlers.SocketHandler.makeSocket()

makeSocket() This is a factory method which allows subclasses to define the precise type of socket they want. The default implementation creates a TCP socket (socket.SOCK_STREAM).

logging.handlers.SocketHandler.makePickle()

makePickle(record) Pickles the record’s attribute dictionary in binary format with a length prefix, and returns it ready for transmission across the socket. Note that pickles aren’t completely secure. If you are concerned about security, you may want to override this method to implement a more secure mechanism. For example, you can sign pickles using HMAC and then verify them on the receiving end, or alternatively you can disable unpickling of global objects on the receiving end.

logging.handlers.SocketHandler.handleError()

handleError() Handles an error which has occurred during emit(). The most likely cause is a lost connection. Closes the socket so that we can retry on the next event.

logging.handlers.SocketHandler.emit()

emit() Pickles the record’s attribute dictionary and writes it to the socket in binary format. If there is an error with the socket, silently drops the packet. If the connection was previously lost, re-establishes the connection. To unpickle the record at the receiving end into a LogRecord, use the makeLogRecord() function.

logging.handlers.SocketHandler.createSocket()

createSocket() Tries to create a socket; on failure, uses an exponential back-off algorithm. On initial failure, the handler will drop the message it was trying to send. When subsequent messages are handled by the same instance, it will not try connecting until some time has passed. The default parameters are such that the initial delay is one second, and if after that delay the connection still can’t be made, the handler will double the delay each time up to a maximum of 30 seconds. This be