File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3068,14 +3068,18 @@ etc.) This means that events which have been generated by descendant loggers
30683068will not be filtered by a logger's filter setting, unless the filter has also
30693069been applied to those descendant loggers.
30703070
3071+ You don't actually need to subclass ``Filter ``: you can pass any instance
3072+ which has a ``filter `` method with the same semantics.
3073+
30713074.. versionchanged :: 3.2
30723075
3073- You don't need to create specialized ``Filter `` classes: you can use a plain
3074- function (or other callable) as a filter. The filtering logic will check to
3075- see if the filter object has a ``filter `` attribute: if it does, it's assumed
3076- to be a ``Filter `` and its :meth: `~Filter.filter ` method is called. Otherwise,
3077- it's assumed to be a callable and called with the record as the single
3078- parameter. The result should conform to that of :meth: `~Filter.filter `.
3076+ You don't need to create specialized ``Filter `` classes, or use other classes
3077+ with a ``filter `` method: you can use a function (or other callable) as a
3078+ filter. The filtering logic will check to see if the filter object has a
3079+ ``filter `` attribute: if it does, it's assumed to be a ``Filter `` and its
3080+ :meth: `~Filter.filter ` method is called. Otherwise, it's assumed to be a
3081+ callable and called with the record as the single parameter. The returned
3082+ value should conform to that returned by :meth: `~Filter.filter `.
30793083
30803084Other uses for filters
30813085^^^^^^^^^^^^^^^^^^^^^^
You can’t perform that action at this time.
0 commit comments