Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
test.test_logging.LogRecordStreamHandler Class Reference
Inheritance diagram for test.test_logging.LogRecordStreamHandler:
Inheritance graph
[legend]
Collaboration diagram for test.test_logging.LogRecordStreamHandler:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def handle
def unpickle
def handle_log_record
def setup
def finish

Public Attributes

 connection
 rfile
 wfile
 request
 client_address
 server

Static Public Attributes

string TCP_LOG_END = "!!!END!!!"
int rbufsize = 1
int wbufsize = 0
 timeout = None
 disable_nagle_algorithm = False

Detailed Description

Handler for a streaming logging request. It saves the log message in the
TCP server's 'log_output' attribute.

Definition at line 869 of file test_logging.py.


Member Function Documentation

def socketserver.StreamRequestHandler.finish (   self) [inherited]

Reimplemented from socketserver.BaseRequestHandler.

Reimplemented in test.test_wsgiref.MockHandler.

Definition at line 691 of file socketserver.py.

00691 
00692     def finish(self):
00693         if not self.wfile.closed:
00694             self.wfile.flush()
00695         self.wfile.close()
00696         self.rfile.close()
00697 

Here is the caller graph for this function:

Handle multiple requests - each expected to be of 4-byte length,
followed by the LogRecord in pickle format. Logs the record
according to whatever policy is configured locally.

Reimplemented from socketserver.BaseRequestHandler.

Definition at line 876 of file test_logging.py.

00876 
00877     def handle(self):
00878         """Handle multiple requests - each expected to be of 4-byte length,
00879         followed by the LogRecord in pickle format. Logs the record
00880         according to whatever policy is configured locally."""
00881         while True:
00882             chunk = self.connection.recv(4)
00883             if len(chunk) < 4:
00884                 break
00885             slen = struct.unpack(">L", chunk)[0]
00886             chunk = self.connection.recv(slen)
00887             while len(chunk) < slen:
00888                 chunk = chunk + self.connection.recv(slen - len(chunk))
00889             obj = self.unpickle(chunk)
00890             record = logging.makeLogRecord(obj)
00891             self.handle_log_record(record)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 895 of file test_logging.py.

00895 
00896     def handle_log_record(self, record):
00897         # If the end-of-messages sentinel is seen, tell the server to
00898         #  terminate.
00899         if self.TCP_LOG_END in record.msg:
00900             self.server.abort = 1
00901             return
00902         self.server.log_output += record.msg + "\n"
00903 

Here is the caller graph for this function:

def socketserver.StreamRequestHandler.setup (   self) [inherited]

Reimplemented from socketserver.BaseRequestHandler.

Reimplemented in test.test_wsgiref.MockHandler.

Definition at line 681 of file socketserver.py.

00681 
00682     def setup(self):
00683         self.connection = self.request
00684         if self.timeout is not None:
00685             self.connection.settimeout(self.timeout)
00686         if self.disable_nagle_algorithm:
00687             self.connection.setsockopt(socket.IPPROTO_TCP,
00688                                        socket.TCP_NODELAY, True)
00689         self.rfile = self.connection.makefile('rb', self.rbufsize)
00690         self.wfile = self.connection.makefile('wb', self.wbufsize)

Here is the caller graph for this function:

Definition at line 892 of file test_logging.py.

00892 
00893     def unpickle(self, data):
00894         return pickle.loads(data)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 634 of file socketserver.py.

Reimplemented in test.test_wsgiref.MockHandler.

Definition at line 682 of file socketserver.py.

Reimplemented in xmlrpc.server.SimpleXMLRPCRequestHandler.

Definition at line 679 of file socketserver.py.

Reimplemented in http.server.CGIHTTPRequestHandler.

Definition at line 671 of file socketserver.py.

Definition at line 633 of file socketserver.py.

Definition at line 688 of file socketserver.py.

Definition at line 635 of file socketserver.py.

Definition at line 874 of file test_logging.py.

socketserver.StreamRequestHandler.timeout = None [static, inherited]

Reimplemented in test.test_imaplib.SimpleIMAPHandler.

Definition at line 675 of file socketserver.py.

Reimplemented in xmlrpc.server.SimpleXMLRPCRequestHandler.

Definition at line 672 of file socketserver.py.

Reimplemented in test.test_wsgiref.MockHandler.

Definition at line 689 of file socketserver.py.


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