8000 gh-115811: Update documentation to add some Logger attributes. by vsajip · Pull Request #116109 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-115811: Update documentation to add some Logger attributes. #116109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
< 8000 div data-view-component="true" class="js-unified-diff-view-box border rounded-1 pt-3 pb-1 color-border-accent-emphasis">
Diff view
gh-115811: Update documentation to add some Logger attributes.
  • Loading branch information
vsajip committed Feb 29, 2024
commit b04a62185b4d61893933f1ee5104ae1e3b3c6e59
36 changes: 36 additions & 0 deletions Doc/library/logging.rst
Original file line number Diff line number Diff line change< C4B1 /th>
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
0