summaryrefslogtreecommitdiffstats
path: root/Lib/logging/handlers.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2019-06-17 16:40:52 (GMT)
committerGitHub <noreply@github.com>2019-06-17 16:40:52 (GMT)
commitca7b504a4d4c3a5fde1ee4607b9501c2bab6e743 (patch)
tree00ebd3f37fbd696b8f70765d624447d470496f62 /Lib/logging/handlers.py
parent00f6493084c385033fe5574314223217d9a26672 (diff)
downloadcpython-ca7b504a4d4c3a5fde1ee4607b9501c2bab6e743.zip
cpython-ca7b504a4d4c3a5fde1ee4607b9501c2bab6e743.tar.gz
cpython-ca7b504a4d4c3a5fde1ee4607b9501c2bab6e743.tar.bz2
bpo-37111: Add 'encoding' and 'errors' parameters to logging.basicCon… (GH-14008)
Diffstat (limited to 'Lib/logging/handlers.py')
-rw-r--r--Lib/logging/handlers.py27
1 files changed, 19 insertions, 8 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 34ff7a0..5641fee 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -48,13 +48,16 @@ class BaseRotatingHandler(logging.FileHandler):
Not meant to be instantiated directly. Instead, use RotatingFileHandler
or TimedRotatingFileHandler.
"""
- def __init__(self, filename, mode, encoding=None, delay=False):
+ def __init__(self, filename, mode, encoding=None, delay=False, errors=None):
"""
Use the specified filename for streamed logging
"""
- logging.FileHandler.__init__(self, filename, mode, encoding, delay)
+ logging.FileHandler.__init__(self, filename, mode=mode,
+ encoding=encoding, delay=delay,
+ errors=errors)
self.mode = mode
self.encoding = encoding
+ self.errors = errors
self.namer = None
self.rotator = None
@@ -117,7 +120,8 @@ class RotatingFileHandler(BaseRotatingHandler):
Handler for logging to a set of files, which switches from one file
to the next when the current file reaches a certain size.
"""
- def __init__(self, filename, mode='a', maxBytes=0, backupCount=0, encoding=None, delay=False):
+ def __init__(self, filename, mode='a', maxBytes=0, backupCount=0,
+ encoding=None, delay=False, errors=None):
"""
Open the specified file and use it as the stream for logging.
@@ -145,7 +149,8 @@ class RotatingFileHandler(BaseRotatingHandler):
# on each run.
if maxBytes > 0:
mode = 'a'
- BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
+ BaseRotatingHandler.__init__(self, filename, mode, encoding=encoding,
+ delay=delay, errors=errors)
self.maxBytes = maxBytes
self.backupCount = backupCount
@@ -196,8 +201,11 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
If backupCount is > 0, when rollover is done, no more than backupCount
files are kept - the oldest ones are deleted.
"""
- def __init__(self, filename, when='h', interval=1, backupCount=0, encoding=None, delay=False, utc=False, atTime=None):
- BaseRotatingHandler.__init__(self, filename, 'a', encoding, delay)
+ def __init__(self, filename, when='h', interval=1, backupCount=0,
+ encoding=None, delay=False, utc=False, atTime=None,
+ errors=None):
+ BaseRotatingHandler.__init__(self, filename, 'a', encoding=encoding,
+ delay=delay, errors=errors)
self.when = when.upper()
self.backupCount = backupCount
self.utc = utc
@@ -431,8 +439,11 @@ class WatchedFileHandler(logging.FileHandler):
This handler is based on a suggestion and patch by Chad J.
Schroeder.
"""
- def __init__(self, filename, mode='a', encoding=None, delay=False):
- logging.FileHandler.__init__(self, filename, mode, encoding, delay)
+ def __init__(self, filename, mode='a', encoding=None, delay=False,
+ errors=None):
+ logging.FileHandler.__init__(self, filename, mode=mode,
+ encoding=encoding, delay=delay,
+ errors=errors)
self.dev, self.ino = -1, -1
self._statstream()