summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2010-12-12 13:25:29 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2010-12-12 13:25:29 (GMT)
commit5286ccfdf8629a6dccad256696cc60000938a45c (patch)
tree5b55b3463612c03adcc3ef641a1ec410224f7499 /Doc/library
parenta18b9594738e13de67332a8f0391a99569341fbc (diff)
downloadcpython-5286ccfdf8629a6dccad256696cc60000938a45c.zip
cpython-5286ccfdf8629a6dccad256696cc60000938a45c.tar.gz
cpython-5286ccfdf8629a6dccad256696cc60000938a45c.tar.bz2
Logging documentation - further update.
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/logging.rst8
1 files changed, 8 insertions, 0 deletions
diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst
index 29854a4..8cfb7d5 100644
--- a/Doc/library/logging.rst
+++ b/Doc/library/logging.rst
@@ -319,6 +319,14 @@ separators. For example, a logger named "scan" is the parent of loggers
"scan.text", "scan.html" and "scan.pdf". Logger names can be anything you want,
and indicate the area of an application in which a logged message originates.
+A good convention to use when naming loggers is to use a module-level logger,
+in each module which uses logging, named as follows::
+
+ logger = logging.getLogger(__name__)
+
+This means that logger names track the package/module hierarchy, and it's
+intuitively obvious where events are logged just from the logger name.
+
The root of the hierarchy of loggers is called the root logger. That's the
logger used by the functions :func:`debug`, :func:`info`, :func:`warning`,
:func:`error` and :func:`critical`, which just call the same-named method of