diff options
| author | Florent Xicluna <florent.xicluna@gmail.com> | 2011-11-07 18:43:05 (GMT) |
|---|---|---|
| committer | Florent Xicluna <florent.xicluna@gmail.com> | 2011-11-07 18:43:05 (GMT) |
| commit | 5252f9faee97573f5b8ff37d7c22225e5df6cc0b (patch) | |
| tree | 780ab582475f423f45005bb673623e3e007e7716 /Lib/logging/handlers.py | |
| parent | 1cdbf57c7cabaa0451cfcf04583f31c9a7eab38d (diff) | |
| download | cpython-5252f9faee97573f5b8ff37d7c22225e5df6cc0b.zip cpython-5252f9faee97573f5b8ff37d7c22225e5df6cc0b.tar.gz cpython-5252f9faee97573f5b8ff37d7c22225e5df6cc0b.tar.bz2 | |
logging: replace codecs.open with builtins.open, remove '_encoded' sort, add some tests.
Diffstat (limited to 'Lib/logging/handlers.py')
| -rw-r--r-- | Lib/logging/handlers.py | 12 |
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: |
