Closes #12419: Added ident to SysLogHandler.

This commit is contained in:
Vinay Sajip 2011-06-27 15:40:06 +01:00
parent 345a5d7357
commit 2353e35570
3 changed files with 17 additions and 0 deletions

View file

@ -769,6 +769,7 @@ class SysLogHandler(logging.Handler):
"""
return self.priority_map.get(levelName, "warning")
ident = '' # prepended to all messages
append_nul = True # some old syslog daemons expect a NUL terminator
def emit(self, record):
@ -779,6 +780,8 @@ class SysLogHandler(logging.Handler):
exception information is present, it is NOT sent to the server.
"""
msg = self.format(record)
if self.ident:
msg = self.ident + msg
if self.append_nul:
msg += '\000'
"""