diff options
| author | Senthil Kumaran <senthil@uthcode.com> | 2012-04-11 03:17:44 +0800 |
|---|---|---|
| committer | Senthil Kumaran <senthil@uthcode.com> | 2012-04-11 03:17:44 +0800 |
| commit | 1cbf78af1fbbfd3a002af246cb260d18df4659b0 (patch) | |
| tree | d78ac73d60631b2fbfbaff6c421c0c4db377a601 /Doc/library | |
| parent | d05853da974d4061d477e120898df448748f6d7d (diff) | |
| parent | 8bf2aea9622ebb74da032c7114e210f13cf06b20 (diff) | |
| download | cpython-git-1cbf78af1fbbfd3a002af246cb260d18df4659b0.tar.gz | |
merge heads
Diffstat (limited to 'Doc/library')
| -rw-r--r-- | Doc/library/logging.rst | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst index c2c6a6fc77..d533c9a21c 100644 --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -49,9 +49,22 @@ listed below. Logger Objects -------------- -Loggers have the following attributes and methods. Note that Loggers are never +Loggers have the following attributes and methods. Note that Loggers are never instantiated directly, but always through the module-level function -``logging.getLogger(name)``. +``logging.getLogger(name)``. Multiple calls to :func:`getLogger` with the same +name will always return a reference to the same Logger object. + +The ``name`` is potentially a period-separated hierarchical value, like +``foo.bar.baz`` (though it could also be just plain ``foo``, for example). +Loggers that are further down in the hierarchical list are children of loggers +higher up in the list. For example, given a logger with a name of ``foo``, +loggers with names of ``foo.bar``, ``foo.bar.baz``, and ``foo.bam`` are all +descendants of ``foo``. The logger name hierarchy is analogous to the Python +package hierarchy, and identical to it if you organise your loggers on a +per-module basis using the recommended construction +``logging.getLogger(__name__)``. That's because in a module, ``__name__`` +is the module's name in the Python package namespace. + .. class:: Logger |
