summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2010-09-20 10:31:18 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2010-09-20 10:31:18 (GMT)
commit83eadd148895abe739026a76f939bec30a4ee3dd (patch)
treec148bf44fe2d71813c129dc9fe7a693ad6328a89
parentae7d7fa0fedca5b3ceb4913623e31630e1498d68 (diff)
downloadcpython-83eadd148895abe739026a76f939bec30a4ee3dd.zip
cpython-83eadd148895abe739026a76f939bec30a4ee3dd.tar.gz
cpython-83eadd148895abe739026a76f939bec30a4ee3dd.tar.bz2
logging: hasHandlers additions documented.
-rw-r--r--Doc/library/logging.rst12
-rw-r--r--Misc/NEWS2
2 files changed, 14 insertions, 0 deletions
diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst
index 7b579f1..5d62d50 100644
--- a/Doc/library/logging.rst
+++ b/Doc/library/logging.rst
@@ -1129,6 +1129,18 @@ instantiated directly, but always through the module-level function
This is a factory method which can be overridden in subclasses to create
specialized :class:`LogRecord` instances.
+.. method:: Logger.hasHandlers()
+
+ Checks to see if this logger has any handlers configured. This is done by
+ looking for handlers in this logger and its parents in the logger hierarchy.
+ Returns True if a handler was found, else False. The method stops searching
+ up the hierarchy whenever a logger with the "propagate" attribute set to
+ False is found - that will be the last logger which is checked for the
+ existence of handlers.
+
+.. versionadded:: 3.2
+
+The :meth:`hasHandlers` method was not present in previous versions.
.. _minimal-example:
diff --git a/Misc/NEWS b/Misc/NEWS
index 40c4cdd..5cac5dc 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -55,6 +55,8 @@ Core and Builtins
Library
-------
+- logging: Added hasHandlers() method to Logger and LoggerAdapter.
+
- Issue #1686: Fix string.Template when overriding the pattern attribute.
- Issue #9854: SocketIO objects now observe the RawIOBase interface in