summaryrefslogtreecommitdiffstats
path: root/Lib/logging/handlers.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-06-27 21:43:39 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-06-27 21:43:39 (GMT)
commit6f3eaa67e51ed0c1b493a26afdf4417d4105d96d (patch)
tree86c1169f5ae3995f8df6ecf137763f4469d7fcb1 /Lib/logging/handlers.py
parent6ebe61fa807d250ccab419473abd8d746a932e75 (diff)
downloadcpython-6f3eaa67e51ed0c1b493a26afdf4417d4105d96d.zip
cpython-6f3eaa67e51ed0c1b493a26afdf4417d4105d96d.tar.gz
cpython-6f3eaa67e51ed0c1b493a26afdf4417d4105d96d.tar.bz2
SF patch #761519: Fixes for bugs 760703 and 757821
SF bug #760703: SocketHandler and LogRecord don't work well together SF bug #757821: logging module docs Applied Vinay Sajip's patch with a few minor fixups and a NEWS item. Patched __init__.py - added new function makeLogRecord (for bug report 760703). Patched handlers.py - updated some docstrings and deleted some old commented-out code. Patched test_logging.py to make use of makeLogRecord. Patched liblogging.tex to fill documentation gaps (both 760703 and bug 757821).
Diffstat (limited to 'Lib/logging/handlers.py')
-rw-r--r--Lib/logging/handlers.py25
1 files changed, 12 insertions, 13 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 4a597a1..7ed1135 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -111,8 +111,12 @@ class SocketHandler(logging.Handler):
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.
- Note that the very simple wire protocol used means that packet sizes
- are expected to be encodable within 16 bits (i.e. < 32767 bytes).
+ 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.
"""
def __init__(self, host, port):
@@ -208,9 +212,12 @@ class SocketHandler(logging.Handler):
class DatagramHandler(SocketHandler):
"""
A handler class which writes logging records, in pickle format, to
- a datagram socket. Note that the very simple wire protocol used means
- that packet sizes are expected to be encodable within 16 bits
- (i.e. < 32767 bytes).
+ a datagram socket. 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.
"""
def __init__(self, host, port):
@@ -236,14 +243,6 @@ class DatagramHandler(SocketHandler):
when the network is busy - UDP does not guarantee delivery and
can deliver packets out of sequence.
"""
- #old code
- #sentsofar = 0
- #left = len(s)
- #addr = (self.host, self.port)
- #while left > 0:
- # sent = self.sock.sendto(s[sentsofar:], addr)
- # sentsofar = sentsofar + sent
- # left = left - sent
self.sock.sendto(s, (self.host, self.port))
class SysLogHandler(logging.Handler):