mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #7077: Backported fix from py3k.
This commit is contained in:
parent
a1e627d61c
commit
e900b494cb
1 changed files with 6 additions and 7 deletions
|
@ -786,20 +786,19 @@ class SysLogHandler(logging.Handler):
|
||||||
The record is formatted, and then sent to the syslog server. If
|
The record is formatted, and then sent to the syslog server. If
|
||||||
exception information is present, it is NOT sent to the server.
|
exception information is present, it is NOT sent to the server.
|
||||||
"""
|
"""
|
||||||
msg = self.format(record)
|
msg = self.format(record) + '\000'
|
||||||
"""
|
"""
|
||||||
We need to convert record level to lowercase, maybe this will
|
We need to convert record level to lowercase, maybe this will
|
||||||
change in the future.
|
change in the future.
|
||||||
"""
|
"""
|
||||||
msg = self.log_format_string % (
|
prio = '<%d>' % self.encodePriority(self.facility,
|
||||||
self.encodePriority(self.facility,
|
self.mapPriority(record.levelname))
|
||||||
self.mapPriority(record.levelname)),
|
# Message is a string. Convert to bytes as required by RFC 5424
|
||||||
msg)
|
if type(msg) is unicode:
|
||||||
# Treat unicode messages as required by RFC 5424
|
|
||||||
if _unicode and type(msg) is unicode:
|
|
||||||
msg = msg.encode('utf-8')
|
msg = msg.encode('utf-8')
|
||||||
if codecs:
|
if codecs:
|
||||||
msg = codecs.BOM_UTF8 + msg
|
msg = codecs.BOM_UTF8 + msg
|
||||||
|
msg = prio + msg
|
||||||
try:
|
try:
|
||||||
if self.unixsocket:
|
if self.unixsocket:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue