A handler class which writes logging records, in pickle format, to a datagram socket. The pickle which is sent is that of the LogRecord's attribute dictionary (__dict__), so that the receiver does not need to have the logging module installed in order to process the logging event.
To unpickle the record at the receiving end into a LogRecord, use the makeLogRecord function.
There are no implemented interfaces.
There are no attributes in this class.
acquire()
Acquire the I/O thread lock.
addFilter(filter)
Add the specified filter to this handler.
close()
Closes the socket.
createLock()
Acquire a thread lock for serializing access to the underlying I/O.
createSocket()
Try to create a socket, using an exponential backoff with a max retry time. Thanks to Robert Olson for the original patch (SF #815911) which has been slightly refactored.
emit(record)
Emit a record.
Pickles the record and writes it to the socket in binary format. If there is an error with the socket, silently drop the packet. If there was a problem with the socket, re-establishes the socket.
filter(record)
Determine if a record is loggable by consulting all the filters.
The default is to allow the record to be logged; any filter can veto this and the record is then dropped. Returns a zero value if a record is to be dropped, else non-zero.
flush()
Ensure all logging output has been flushed.
This version does nothing and is intended to be implemented by subclasses.
format(record)
Format the specified record.
If a formatter is set, use it. Otherwise, use the default formatter for the module.
handle(record)
Conditionally emit the specified logging record.
Emission depends on filters which may have been added to the handler. Wrap the actual emission of the record with acquisition/release of the I/O thread lock. Returns whether the filter passed the record for emission.
handleError(record)
Handle an error during logging.
An error has occurred during logging. Most likely cause - connection lost. Close the socket so that we can retry on the next event.
makePickle(record)
Pickles the record in binary format with a length prefix, and returns it ready for transmission across the socket.
makeSocket()
The factory method of SocketHandler is here overridden to create a UDP socket (SOCK_DGRAM).
release()
Release the I/O thread lock.
removeFilter(filter)
Remove the specified filter from this handler.
send(s)
Send a pickled string to a socket.
This function no longer allows for partial sends which can happen when the network is busy - UDP does not guarantee delivery and can deliver packets out of sequence.
setFormatter(fmt)
Set the formatter for this handler.
setLevel(level)
Set the logging level of this handler.
There are no known subclasses.