From 83eadd148895abe739026a76f939bec30a4ee3dd Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Mon, 20 Sep 2010 10:31:18 +0000 Subject: [PATCH] logging: hasHandlers additions documented. --- Doc/library/logging.rst | 12 ++++++++++++ Misc/NEWS | 2 ++ 2 files changed, 14 insertions(+) diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst index 7b579f15c51..5d62d508f3a 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 40c4cdd58f1..5cac5dcf21a 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