lorb <[email protected]> added the comment:
I looked into implementing this and it's not entirely clear how it could work.
The main issue I encountered is how to distinguish between a callable that is a
factory that takes one argument and a callable that is a filter.
One possible approach I see is to rely on the absence of any other keys in the
configuration sub-directory. Not entirely happy with that (and have to think
how to treat factory with optional parameter vs filter with optional parameter).
So this would be assumed to be a filter, if inspection reveals that fltr takes
an argument:
'myfilter': {
'()': fltr,
}
while this would be assumed to be a factory:
'myfilter': {
'()': fctry,
'bar': 'baz',
}
A different approach that I think would be not optimal is to just call the
callable with a dummy LogRecord passed ind and see if it returns a boolean or
callable (or throws).
----------
nosy: +lorb
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue41906>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com