mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-31457: Don't omit inner `process()
` calls with nested LogAdapters (#4044)
This used to be the case on Python 2. Commit
212b590e11
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.
This commit is contained in:
parent
05a634b12a
commit
ce9e625445
3 changed files with 21 additions and 7 deletions
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue