[Python-checkins] r85736 - in python/branches: py3k/Doc/library/logging.rst release27-maint/Doc/library/logging.rst

vinay.sajip python-checkins at python.org
Wed Oct 20 13:40:03 CEST 2010


Author: vinay.sajip
Date: Wed Oct 20 13:40:02 2010
New Revision: 85736

Log:
logging: clarified Filter documentation.

Modified:
   python/branches/py3k/Doc/library/logging.rst
   python/branches/release27-maint/Doc/library/logging.rst

Modified: python/branches/py3k/Doc/library/logging.rst
==============================================================================
--- python/branches/py3k/Doc/library/logging.rst	(original)
+++ python/branches/py3k/Doc/library/logging.rst	Wed Oct 20 13:40:02 2010
@@ -3068,14 +3068,18 @@
 will not be filtered by a logger's filter setting, unless the filter has also
 been applied to those descendant loggers.
 
+You don't actually need to subclass ``Filter``: you can pass any instance
+which has a ``filter`` method with the same semantics.
+
 .. versionchanged:: 3.2
 
-You don't need to create specialized ``Filter`` classes: you can use a plain
-function (or other callable) as a filter. The filtering logic will check to
-see if the filter object has a ``filter`` attribute: if it does, it's assumed
-to be a ``Filter`` and its :meth:`~Filter.filter` method is called. Otherwise,
-it's assumed to be a callable and called with the record as the single
-parameter. The result should conform to that of :meth:`~Filter.filter`.
+You don't need to create specialized ``Filter`` classes, or use other classes
+with a ``filter`` method: you can use a function (or other callable) as a
+filter. The filtering logic will check to see if the filter object has a
+``filter`` attribute: if it does, it's assumed to be a ``Filter`` and its
+:meth:`~Filter.filter` method is called. Otherwise, it's assumed to be a
+callable and called with the record as the single parameter. The returned
+value should conform to that returned by :meth:`~Filter.filter`.
 
 Other uses for filters
 ^^^^^^^^^^^^^^^^^^^^^^

Modified: python/branches/release27-maint/Doc/library/logging.rst
==============================================================================
--- python/branches/release27-maint/Doc/library/logging.rst	(original)
+++ python/branches/release27-maint/Doc/library/logging.rst	Wed Oct 20 13:40:02 2010
@@ -2708,6 +2708,9 @@
 will not be filtered by a logger's filter setting, unless the filter has also
 been applied to those descendant loggers.
 
+You don't actually need to subclass ``Filter``: you can pass any instance
+which has a ``filter`` method with the same semantics.
+
 Other uses for filters
 ^^^^^^^^^^^^^^^^^^^^^^
 


More information about the Python-checkins mailing list