Created
August 24, 2011 13:26
-
-
Save romuald/1168049 to your computer and use it in GitHub Desktop.
syslog handler fix for python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from logging.handlers import SysLogHandler as Base | |
class SysLogHandler(Base): | |
def emit(self, record): | |
if type(record.msg) is unicode: | |
# RFC says we should prefix with BOM, but rsyslog will log the BOM | |
record.msg = record.msg.encode('utf-8') | |
return Base.emit(self, record) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment