mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-43731: Add an encoding
parameter to logging.fileConfig() (GH-25273)
This commit is contained in:
parent
a4833883c9
commit
c2b7a66b91
3 changed files with 10 additions and 3 deletions
|
@ -48,7 +48,7 @@ RESET_ERROR = errno.ECONNRESET
|
|||
# _listener holds the server object doing the listening
|
||||
_listener = None
|
||||
|
||||
def fileConfig(fname, defaults=None, disable_existing_loggers=True):
|
||||
def fileConfig(fname, defaults=None, disable_existing_loggers=True, encoding=None):
|
||||
"""
|
||||
Read the logging configuration from a ConfigParser-format file.
|
||||
|
||||
|
@ -66,7 +66,8 @@ def fileConfig(fname, defaults=None, disable_existing_loggers=True):
|
|||
if hasattr(fname, 'readline'):
|
||||
cp.read_file(fname)
|
||||
else:
|
||||
cp.read(fname)
|
||||
encoding = io.text_encoding(encoding)
|
||||
cp.read(fname, encoding=encoding)
|
||||
|
||||
formatters = _create_formatters(cp)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue