summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2011-06-09 15:50:49 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2011-06-09 15:50:49 (GMT)
commit8168d10ea683d939ae52a1ed3d7c697c92bfae3d (patch)
treedf5f8d97c1c938589ee9dd6afdd3560e2409c155 /Lib/logging
parent95d028fd18fc33ceac8b2727a1e9fe3d4a8256b8 (diff)
downloadcpython-8168d10ea683d939ae52a1ed3d7c697c92bfae3d.zip
cpython-8168d10ea683d939ae52a1ed3d7c697c92bfae3d.tar.gz
cpython-8168d10ea683d939ae52a1ed3d7c697c92bfae3d.tar.bz2
Issue #12168: SysLogHandler now allows NUL termination to be controlled using a new 'append_nul' attribute on the handler.
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/handlers.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 306cf86..4a6b959 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -766,6 +766,8 @@ class SysLogHandler(logging.Handler):
"""
return self.priority_map.get(levelName, "warning")
+ append_nul = True # some old syslog daemons expect a NUL terminator
+
def emit(self, record):
"""
Emit a record.
@@ -773,7 +775,9 @@ class SysLogHandler(logging.Handler):
The record is formatted, and then sent to the syslog server. If
exception information is present, it is NOT sent to the server.
"""
- msg = self.format(record) + '\000'
+ msg = self.format(record)
+ if self.append_nul:
+ msg += '\000'
"""
We need to convert record level to lowercase, maybe this will
change in the future.