diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2014-11-01 19:56:13 +0000 |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2014-11-01 19:56:13 +0000 |
commit | a79d6f40dfa6dc0df03db489e27532a5a1b644cc (patch) | |
tree | eac7d6bcc3df86f9a8b389f85bad0430e81c83ee /Lib/logging | |
parent | 409062c669e4d3163b494a73d119aede66700f41 (diff) | |
download | cpython-git-a79d6f40dfa6dc0df03db489e27532a5a1b644cc.tar.gz |
Brought excluded code into the scope of a try block in SysLogHandler.emit().
Diffstat (limited to 'Lib/logging')
-rw-r--r-- | Lib/logging/handlers.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index 201d2b5a7d..a458529684 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -840,18 +840,18 @@ 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' - """ - We need to convert record level to lowercase, maybe this will - change in the future. - """ - prio = '<%d>' % self.encodePriority(self.facility, - self.mapPriority(record.levelname)) - # Message is a string. Convert to bytes as required by RFC 5424 - if type(msg) is unicode: - msg = msg.encode('utf-8') - msg = prio + msg try: + msg = self.format(record) + '\000' + """ + We need to convert record level to lowercase, maybe this will + change in the future. + """ + prio = '<%d>' % self.encodePriority(self.facility, + self.mapPriority(record.levelname)) + # Message is a string. Convert to bytes as required by RFC 5424 + if type(msg) is unicode: + msg = msg.encode('utf-8') + msg = prio + msg if self.unixsocket: try: self.socket.send(msg) |