PyDocs

Nav

Generic Operating System Services

SocketHandler

  • SocketHandler(host, port)
A handler class which writes logging records, in pickle format, to
a streaming socket. The socket is kept open across logging calls.
If the peer resets it, an attempt is made to reconnect on the next call.
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.
Changed in 3.4
  • 3.4: If port is specified as None, a Unix domain socket is created using the value in host - otherwise, a TCP socket is created.
Members of SocketHandler

c

close
Closes the socket.
createSocket
Try to create a socket, using an exponential backoff with a max retry time.

e

emit
Emit a record.

h

handleError
Handle an error during logging.

m

makePickle
Pickles the record in binary format with a length prefix, and returns it ready for transmission across the socket.
makeSocket
A factory method which allows subclasses to define the precise type of socket they want.

s

send
Send a pickled string to the socket.
0 Examples
No examples for logging.handlers/SocketHandler.
See Also
No see-alsos for logging.handlers/SocketHandler
0 Notes
No notes for SocketHandler