summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorƁukasz Langa <lukasz@langa.pl>2017-10-19 17:24:55 (GMT)
committerGitHub <noreply@github.com>2017-10-19 17:24:55 (GMT)
commitce9e62544571e7ade7186697d5dd065fb4c5243f (patch)
tree1ba66445412bb1b0fcbbb46d7a19cd5fa2b3de8d /Lib/logging
parent05a634b12a8207611ae8e9d051427d615fcacb69 (diff)
downloadcpython-ce9e62544571e7ade7186697d5dd065fb4c5243f.zip
cpython-ce9e62544571e7ade7186697d5dd065fb4c5243f.tar.gz
cpython-ce9e62544571e7ade7186697d5dd065fb4c5243f.tar.bz2
bpo-31457: Don't omit inner ``process()`` calls with nested LogAdapters (#4044)
This used to be the case on Python 2. Commit 212b590e118e3650b596917021ed9612a918180b changed the implementation for Python 3, making the `log()` method of LogAdapter call `logger._log()` directly. This makes nested log adapters not execute their ``process()`` method. This patch fixes the issue. Also, now proxying `name`, too, to make `repr()` work with nested log adapters. New tests added.
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 7544190..9f2c0f0 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -1713,7 +1713,7 @@ class LoggerAdapter(object):
"""
if self.isEnabledFor(level):
msg, kwargs = self.process(msg, kwargs)
- self.logger._log(level, msg, args, **kwargs)
+ self.logger.log(level, msg, *args, **kwargs)
def isEnabledFor(self, level):
"""
@@ -1760,6 +1760,10 @@ class LoggerAdapter(object):
def manager(self, value):
self.logger.manager = value
+ @property
+ def name(self):
+ return self.logger.name
+
def __repr__(self):
logger = self.logger
level = getLevelName(logger.getEffectiveLevel())