diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2012-04-10 18:59:50 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2012-04-10 18:59:50 (GMT) |
commit | 074faff92526106bf89a786490fff79ef66e0722 (patch) | |
tree | 2540c90cd4daf166dc597064eae6b2a56562e7a0 /Doc/library | |
parent | 935b62968e7b8e38fa5d91441d2eb48f2fbda2da (diff) | |
download | cpython-074faff92526106bf89a786490fff79ef66e0722.zip cpython-074faff92526106bf89a786490fff79ef66e0722.tar.gz cpython-074faff92526106bf89a786490fff79ef66e0722.tar.bz2 |
Updated logging reference and HOWTO.
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 1005b79..dc97726 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 |