File: libraries.rst

package info (click to toggle)
python-logutils 0.3.5-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 404 kB
  • sloc: python: 1,942; makefile: 79
file content (25 lines) | stat: -rw-r--r-- 672 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Configuring Libraries
=====================

When developing libraries, you'll probably need to use the
:class:`~logutils.NullHandler` class.

**N.B.** This is part of the standard library since Python 2.7 / 3.1, so the
version here is for use with earlier Python versions.

Typical usage::

    import logging
    try:
        from logging import NullHandler
    except ImportError:
        from logutils import NullHandler

     # use this in all your library's subpackages/submodules
    logger = logging.getLogger(__name__)

    # use this just in your library's top-level package
    logger.addHandler(NullHandler())

.. autoclass:: logutils.NullHandler
   :members: