diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-03-01 08:57:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-01 08:57:30 (GMT) |
commit | 753b6644e3b342ad0d713cb758f37e6b29a5af04 (patch) | |
tree | 0cdab8171830988a2d73f1e8a4981fe47f3c694e | |
parent | 2cf68dbe2907d13a8d34a6df42ec5b506dd4f1d9 (diff) | |
download | cpython-753b6644e3b342ad0d713cb758f37e6b29a5af04.zip cpython-753b6644e3b342ad0d713cb758f37e6b29a5af04.tar.gz cpython-753b6644e3b342ad0d713cb758f37e6b29a5af04.tar.bz2 |
[3.12] gh-115811: Update documentation to add some Logger attributes. (GH-116109) (GH-116185)
(cherry picked from commit 3b6f4cadf19e6a4edd2cbbbc96a0a4024b395648)
-rw-r--r-- | Doc/library/logging.rst | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst index 6759544..fc3af7a 100644 --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -77,6 +77,27 @@ is the module's name in the Python package namespace. .. class:: Logger + .. attribute:: Logger.name + + This is the logger's name, and is the value that was passed to :func:`getLogger` + to obtain the logger. + + .. note:: This attribute should be treated as read-only. + + .. attribute:: Logger.level + + The threshold of this logger, as set by the :meth:`setLevel` method. + + .. note:: Do not set this attribute directly - always use :meth:`setLevel`, + which has checks for the level passed to it. + + .. attribute:: Logger.parent + + The parent logger of this logger. It may change based on later instantiation + of loggers which are higher up in the namespace hierarchy. + + .. note:: This value should be treated as read-only. + .. attribute:: Logger.propagate If this attribute evaluates to true, events logged to this logger will be @@ -108,6 +129,21 @@ is the module's name in the Python package namespace. scenario is to attach handlers only to the root logger, and to let propagation take care of the rest. + .. attribute:: Logger.handlers + + The list of handlers directly attached to this logger instance. + + .. note:: This attribute should be treated as read-only; it is normally changed via + the :meth:`addHandler` and :meth:`removeHandler` methods, which use locks to ensure + thread-safe operation. + + .. attribute:: Logger.disabled + + This attribute disables handling of any events. It is set to ``False`` in the + initializer, and only changed by logging configuration code. + + .. note:: This attribute should be treated as read-only. + .. method:: Logger.setLevel(level) Sets the threshold for this logger to *level*. Logging messages which are less |