diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-12-07 11:45:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-07 11:45:13 (GMT) |
commit | f78c229b4ec8621a9b15c6396b6c91518e8975d6 (patch) | |
tree | 1916539622e94d6f70e8bae21d31f4d872366936 /Doc/library | |
parent | 15da2a2723245710f1bd2c7cbd5b450532ae7728 (diff) | |
download | cpython-f78c229b4ec8621a9b15c6396b6c91518e8975d6.zip cpython-f78c229b4ec8621a9b15c6396b6c91518e8975d6.tar.gz cpython-f78c229b4ec8621a9b15c6396b6c91518e8975d6.tar.bz2 |
[3.10] bpo-35821: Add an example to Logger.propagate documentation. (GH-29841) (GH-29957)
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/logging.rst | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst index bb1bbf0..ade4a3c 100644 --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -80,6 +80,15 @@ is the module's name in the Python package namespace. If this evaluates to false, logging messages are not passed to the handlers of ancestor loggers. + Spelling it out with an example: If the propagate attribute of the logger named + `A.B.C` evaluates to true, any event logged to `A.B.C` via a method call such as + `logging.getLogger('A.B.C').error(...)` will [subject to passing that logger's + level and filter settings] be passed in turn to any handlers attached to loggers + named `A.B`, `A` and the root logger, after first being passed to any handlers + attached to `A.B.C`. If any logger in the chain `A.B.C`, `A.B`, `A` has its + `propagate` attribute set to false, then that is the last logger whose handlers + are offered the event to handle, and propagation stops at that point. + The constructor sets this attribute to ``True``. .. note:: If you attach a handler to a logger *and* one or more of its |