Skip to content

Commit 0569ad2

Browse files
author
vinay.sajip
committed
Minor documentation changes relating to NullHandler, the module used for handlers and references to ConfigParser.
git-svn-id: http://svn.python.org/projects/python/trunk@68167 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent b641787 commit 0569ad2

File tree

1 file changed

+38
-19
lines changed

1 file changed

+38
-19
lines changed

Doc/library/logging.rst

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,8 +1559,6 @@ subclasses. However, the :meth:`__init__` method in subclasses needs to call
15591559
StreamHandler
15601560
^^^^^^^^^^^^^
15611561

1562-
.. module:: logging.handlers
1563-
15641562
The :class:`StreamHandler` class, located in the core :mod:`logging` package,
15651563
sends logging output to streams such as *sys.stdout*, *sys.stderr* or any
15661564
file-like object (or, more precisely, any object which supports :meth:`write`
@@ -1616,11 +1614,32 @@ sends logging output to a disk file. It inherits the output functionality from
16161614
Outputs the record to the file.
16171615

16181616

1617+
NullHandler
1618+
^^^^^^^^^^^
1619+
1620+
.. versionadded:: 2.7
1621+
1622+
The :class:`NullHandler` class, located in the core :mod:`logging` package,
1623+
does not do any formatting or output. It is essentially a "no-op" handler
1624+
for use by library developers.
1625+
1626+
1627+
.. class:: NullHandler()
1628+
1629+
Returns a new instance of the :class:`NullHandler` class.
1630+
1631+
1632+
.. method:: emit(record)
1633+
1634+
This method does nothing.
1635+
16191636
WatchedFileHandler
16201637
^^^^^^^^^^^^^^^^^^
16211638

16221639
.. versionadded:: 2.6
16231640

1641+
.. module:: logging.handlers
1642+
16241643
The :class:`WatchedFileHandler` class, located in the :mod:`logging.handlers`
16251644
module, is a :class:`FileHandler` which watches the file it is logging to. If
16261645
the file changes, it is closed and reopened using the file name.
@@ -2304,12 +2323,12 @@ in :mod:`logging` itself) and defining handlers which are declared either in
23042323

23052324
.. function:: fileConfig(fname[, defaults])
23062325

2307-
Reads the logging configuration from a ConfigParser-format file named *fname*.
2308-
This function can be called several times from an application, allowing an end
2309-
user the ability to select from various pre-canned configurations (if the
2310-
developer provides a mechanism to present the choices and load the chosen
2311-
configuration). Defaults to be passed to ConfigParser can be specified in the
2312-
*defaults* argument.
2326+
Reads the logging configuration from a :mod:`ConfigParser`\-format file named
2327+
*fname*. This function can be called several times from an application,
2328+
allowing an end user the ability to select from various pre-canned
2329+
configurations (if the developer provides a mechanism to present the choices
2330+
and load the chosen configuration). Defaults to be passed to the ConfigParser
2331+
can be specified in the *defaults* argument.
23132332

23142333

23152334
.. function:: listen([port])
@@ -2340,17 +2359,17 @@ Configuration file format
23402359
^^^^^^^^^^^^^^^^^^^^^^^^^
23412360

23422361
The configuration file format understood by :func:`fileConfig` is based on
2343-
ConfigParser functionality. The file must contain sections called ``[loggers]``,
2344-
``[handlers]`` and ``[formatters]`` which identify by name the entities of each
2345-
type which are defined in the file. For each such entity, there is a separate
2346-
section which identified how that entity is configured. Thus, for a logger named
2347-
``log01`` in the ``[loggers]`` section, the relevant configuration details are
2348-
held in a section ``[logger_log01]``. Similarly, a handler called ``hand01`` in
2349-
the ``[handlers]`` section will have its configuration held in a section called
2350-
``[handler_hand01]``, while a formatter called ``form01`` in the
2351-
``[formatters]`` section will have its configuration specified in a section
2352-
called ``[formatter_form01]``. The root logger configuration must be specified
2353-
in a section called ``[logger_root]``.
2362+
:mod:`ConfigParser` functionality. The file must contain sections called
2363+
``[loggers]``, ``[handlers]`` and ``[formatters]`` which identify by name the
2364+
entities of each type which are defined in the file. For each such entity,
2365+
there is a separate section which identifies how that entity is configured.
2366+
Thus, for a logger named ``log01`` in the ``[loggers]`` section, the relevant
2367+
configuration details are held in a section ``[logger_log01]``. Similarly, a
2368+
handler called ``hand01`` in the ``[handlers]`` section will have its
2369+
configuration held in a section called ``[handler_hand01]``, while a formatter
2370+
called ``form01`` in the ``[formatters]`` section will have its configuration
2371+
specified in a section called ``[formatter_form01]``. The root logger
2372+
configuration must be specified in a section called ``[logger_root]``.
23542373

23552374
Examples of these sections in the file are given below. ::
23562375

0 commit comments

Comments
 (0)