mirror of
https://github.com/python/cpython.git
synced 2025-09-18 22:50:26 +00:00
Brought excluded code into the scope of a try block in SysLogHandler.emit().
This commit is contained in:
parent
8083cd6c3b
commit
c33a0cc61e
2 changed files with 17 additions and 14 deletions
|
@ -879,21 +879,21 @@ 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)
|
|
||||||
if self.ident:
|
|
||||||
msg = self.ident + msg
|
|
||||||
if self.append_nul:
|
|
||||||
msg += '\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))
|
|
||||||
prio = prio.encode('utf-8')
|
|
||||||
# Message is a string. Convert to bytes as required by RFC 5424
|
|
||||||
msg = msg.encode('utf-8')
|
|
||||||
msg = prio + msg
|
|
||||||
try:
|
try:
|
||||||
|
msg = self.format(record)
|
||||||
|
if self.ident:
|
||||||
|
msg = self.ident + msg
|
||||||
|
if self.append_nul:
|
||||||
|
msg += '\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))
|
||||||
|
prio = prio.encode('utf-8')
|
||||||
|
# Message is a string. Convert to bytes as required by RFC 5424
|
||||||
|
msg = msg.encode('utf-8')
|
||||||
|
msg = prio + msg
|
||||||
if self.unixsocket:
|
if self.unixsocket:
|
||||||
try:
|
try:
|
||||||
self.socket.send(msg)
|
self.socket.send(msg)
|
||||||
|
|
|
@ -33,6 +33,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #22776: Brought excluded code into the scope of a try block in
|
||||||
|
SysLogHandler.emit().
|
||||||
|
|
||||||
- Issue #22665: Add missing get_terminal_size and SameFileError to
|
- Issue #22665: Add missing get_terminal_size and SameFileError to
|
||||||
shutil.__all__.
|
shutil.__all__.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue