Fix casing of SocketServer module in 2.7.
This commit is contained in:
parent
d26b658f14
commit
eb068f9fa1
|
@ -295,17 +295,17 @@ the receiving end. A simple way of doing this is attaching a
|
||||||
logger2.warning('Jail zesty vixen who grabbed pay from quack.')
|
logger2.warning('Jail zesty vixen who grabbed pay from quack.')
|
||||||
logger2.error('The five boxing wizards jump quickly.')
|
logger2.error('The five boxing wizards jump quickly.')
|
||||||
|
|
||||||
At the receiving end, you can set up a receiver using the :mod:`socketserver`
|
At the receiving end, you can set up a receiver using the :mod:`SocketServer`
|
||||||
module. Here is a basic working example::
|
module. Here is a basic working example::
|
||||||
|
|
||||||
import pickle
|
import pickle
|
||||||
import logging
|
import logging
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
import socketserver
|
import SocketServer
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
|
|
||||||
class LogRecordStreamHandler(socketserver.StreamRequestHandler):
|
class LogRecordStreamHandler(SocketServer.StreamRequestHandler):
|
||||||
"""Handler for a streaming logging request.
|
"""Handler for a streaming logging request.
|
||||||
|
|
||||||
This basically logs the record using whatever logging policy is
|
This basically logs the record using whatever logging policy is
|
||||||
|
@ -347,7 +347,7 @@ module. Here is a basic working example::
|
||||||
# cycles and network bandwidth!
|
# cycles and network bandwidth!
|
||||||
logger.handle(record)
|
logger.handle(record)
|
||||||
|
|
||||||
class LogRecordSocketReceiver(socketserver.ThreadingTCPServer):
|
class LogRecordSocketReceiver(SocketServer.ThreadingTCPServer):
|
||||||
"""
|
"""
|
||||||
Simple TCP socket-based logging receiver suitable for testing.
|
Simple TCP socket-based logging receiver suitable for testing.
|
||||||
"""
|
"""
|
||||||
|
@ -357,7 +357,7 @@ module. Here is a basic working example::
|
||||||
def __init__(self, host='localhost',
|
def __init__(self, host='localhost',
|
||||||
port=logging.handlers.DEFAULT_TCP_LOGGING_PORT,
|
port=logging.handlers.DEFAULT_TCP_LOGGING_PORT,
|
||||||
handler=LogRecordStreamHandler):
|
handler=LogRecordStreamHandler):
|
||||||
socketserver.ThreadingTCPServer.__init__(self, (host, port), handler)
|
SocketServer.ThreadingTCPServer.__init__(self, (host, port), handler)
|
||||||
self.abort = 0
|
self.abort = 0
|
||||||
self.timeout = 1
|
self.timeout = 1
|
||||||
self.logname = None
|
self.logname = None
|
||||||
|
|
Loading…
Reference in New Issue