mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
logging: Documented usage of callables as filters.
This commit is contained in:
parent
435d306aa9
commit
fc082cafa6
2 changed files with 16 additions and 12 deletions
|
|
@ -613,13 +613,8 @@ class Filterer(object):
|
|||
for f in self.filters:
|
||||
if hasattr(f, 'filter'):
|
||||
result = f.filter(record)
|
||||
elif hasattr(f, '__call__'):
|
||||
try:
|
||||
result = f(record)
|
||||
except Exception:
|
||||
result = True # filter failed, assume a pass
|
||||
else:
|
||||
result = False # we don't know what f is
|
||||
result = f(record) # assume callable - will raise if not
|
||||
if not result:
|
||||
rv = 0
|
||||
break
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue