6.29.5.5 SocketHandler

Python 2.4

6.29.5.5 SocketHandler

The SocketHandler class sends logging output to a network socket. The base class uses a TCP socket.

Returns a new instance of the SocketHandler class intended to communicate with a remote machine whose address is given by host and port.

Closes the socket.

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.

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.

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).

Pickles the record's attribute dictionary in binary format with a length prefix, and returns it ready for transmission across the socket.

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

See About this document... for information on suggesting changes.