webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Public Member Functions | Public Attributes | List of all members
compat_logging.handlers.SocketHandler Class Reference
Inheritance diagram for compat_logging.handlers.SocketHandler:
compat_logging.handlers.DatagramHandler

Public Member Functions

def __init__ (self, host, port)
 
def makeSocket (self)
 
def send (self, s)
 
def makePickle (self, record)
 
def handleError (self, record)
 
def emit (self, record)
 
def close (self)
 

Public Attributes

 host
 
 port
 
 sock
 
 closeOnError
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ __init__()

def compat_logging.handlers.SocketHandler.__init__ (   self,
  host,
  port 
)
Initializes the handler with a specific host address and port.

The attribute 'closeOnError' is set to 1 - which means that if
a socket error occurs, the socket is silently closed and then
reopened on the next logging call.

Member Function Documentation

◆ close()

def compat_logging.handlers.SocketHandler.close (   self)
Closes the socket.

◆ emit()

def compat_logging.handlers.SocketHandler.emit (   self,
  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.

◆ handleError()

def compat_logging.handlers.SocketHandler.handleError (   self,
  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()

def compat_logging.handlers.SocketHandler.makePickle (   self,
  record 
)
Pickles the record in binary format with a length prefix, and
returns it ready for transmission across the socket.

◆ makeSocket()

def compat_logging.handlers.SocketHandler.makeSocket (   self)
A factory method which allows subclasses to define the precise
type of socket they want.

◆ send()

def compat_logging.handlers.SocketHandler.send (   self,
  s 
)
Send a pickled string to the socket.

This function allows for partial sends which can happen when the
network is busy.

Member Data Documentation

◆ closeOnError

compat_logging.handlers.SocketHandler.closeOnError

◆ host

compat_logging.handlers.SocketHandler.host

◆ port

compat_logging.handlers.SocketHandler.port

◆ sock

compat_logging.handlers.SocketHandler.sock

The documentation for this class was generated from the following file: