8000 gh-115811: Update documentation to add some Logger attributes. (GH-11… · python/cpython@3b6f4ca · GitHub
[go: up one dir, main page]

Skip to content

Commit 3b6f4ca

Browse files
authored
gh-115811: Update documentation to add some Logger attributes. (GH-116109)
1 parent 04d1000 commit 3b6f4ca

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

Doc/library/logging.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,27 @@ is the module's name in the Python package namespace.
7777

7878
.. class:: Logger
7979

80+
.. attribute:: Logger.name
81+
82+
This is the logger's name, and is the value that was passed to :func:`getLogger`
83+
to obtain the logger.
84+
85+
.. note:: This attribute should be treated as read-only.
86+
87+
.. attribute:: Logger.level
88+
89+
The threshold of this logger, as set by the :meth:`setLevel` method.
90+
91+
.. note:: Do not set this attribute directly - always use :meth:`setLevel`,
92+
which has checks for the level passed to it.
93+
94+
.. attribute:: Logger.parent
95+
96+
The parent logger of this logger. It may change based on later instantiation
97+
of loggers which are higher up in the namespace hierarchy.
98+
99+
.. note:: This value should be treated as read-only.
100+
80101
.. attribute:: Logger.propagate
81102

82103
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.
108129
scenario is to attach handlers only to the root logger, and to let
109130
propagation take care of the rest.
110131

132+
.. attribute:: Logger.handlers
133+
134+
The list of handlers directly attached to this logger instance.
135+
136+
.. note:: This attribute should be treated as read-only; it is normally changed via
137+
the :meth:`addHandler` and :meth:`removeHandler` methods, which use locks to ensure
138+
thread-safe operation.
139+
140+
.. attribute:: Logger.disabled
141+
142+
This attribute disables handling of any events. It is set to ``False`` in the
143+
initializer, and only changed by logging configuration code.
144+
145+
.. note:: This attribute should be treated as read-only.
146+
111147
.. method:: Logger.setLevel(level)
112148

113149
Sets the threshold for this logger to *level*. Logging messages which are less

0 commit comments

Comments
 (0)
0