summaryrefslogtreecommitdiffstats
path: root/Lib/logging/handlers.py
diff options
context:
space:
mode:
authorBrian Curtin <brian@python.org>2011-11-07 20:19:46 (GMT)
committerBrian Curtin <brian@python.org>2011-11-07 20:19:46 (GMT)
commitca0fbc02e9971ead5436473e15320652c1fd97c8 (patch)
tree4b54cf71920a50bceed96d6f575ed1cbf0abac17 /Lib/logging/handlers.py
parentc1b65d1831265534cb1613d7bf0ad7643fddb795 (diff)
parentca6befb77f007ee74137bcbfc26f3fe1345bd886 (diff)
downloadcpython-ca0fbc02e9971ead5436473e15320652c1fd97c8.zip
cpython-ca0fbc02e9971ead5436473e15320652c1fd97c8.tar.gz
cpython-ca0fbc02e9971ead5436473e15320652c1fd97c8.tar.bz2
branch merge
Diffstat (limited to 'Lib/logging/handlers.py')
-rw-r--r--Lib/logging/handlers.py12
1 files changed, 2 insertions, 10 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index ef17081..52e18e5 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -25,6 +25,7 @@ To use, simply 'import logging.handlers' and log away!
"""
import logging, socket, os, pickle, struct, time, re
+from codecs import BOM_UTF8
from stat import ST_DEV, ST_INO, ST_MTIME
import queue
try:
@@ -32,11 +33,6 @@ try:
except ImportError: #pragma: no cover
threading = None
-try:
- import codecs
-except ImportError: #pragma: no cover
- codecs = None
-
#
# Some constants...
#
@@ -60,8 +56,6 @@ class BaseRotatingHandler(logging.FileHandler):
"""
Use the specified filename for streamed logging
"""
- if codecs is None: #pragma: no cover
- encoding = None
logging.FileHandler.__init__(self, filename, mode, encoding, delay)
self.mode = mode
self.encoding = encoding
@@ -793,9 +787,7 @@ class SysLogHandler(logging.Handler):
prio = prio.encode('utf-8')
# Message is a string. Convert to bytes as required by RFC 5424
msg = msg.encode('utf-8')
- if codecs:
- msg = codecs.BOM_UTF8 + msg
- msg = prio + msg
+ msg = prio + BOM_UTF8 + msg
try:
if self.unixsocket:
try: