[issue30862] parent logger should also check the level
TaoQingyun
report at bugs.python.org
Thu Jul 6 04:17:15 EDT 2017
TaoQingyun added the comment:
yes, I understand the effective level. my question is that before call ancestor's handler, should also check `c.isEnabledFor(record.levelno)`
```
def callHandlers(self, record):
"""
Pass a record to all relevant handlers.
Loop through all handlers for this logger and its parents in the
logger hierarchy. If no handler was found, output a one-off error
message to sys.stderr. Stop searching up the hierarchy whenever a
logger with the "propagate" attribute set to zero is found - that
will be the last logger whose handlers are called.
"""
c = self
found = 0
while c:
for hdlr in c.handlers:
found = found + 1
if record.levelno >= hdlr.level:
hdlr.handle(record)
if not c.propagate:
c = None #break out
else:
c = c.parent
...
```
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30862>
_______________________________________
More information about the Python-bugs-list
mailing list