mpacts.core.units.compat. nullhandler

Taken from the Python 2.7 source code.

copyright:2013, PSF
license:PSF License

In order to be able to use this module import it like this:

import mpacts.core.units.compat.nullhandler
#or assign it to a shorter name
import mpacts.core.units.compat.nullhandler as nul


class mpacts.core.units.compat.nullhandler.NullHandler(level=0)

Bases: logging.Handler

This handler does nothing. It’s intended to be used to avoid the “No handlers could be found for logger XXX” one-off warning. This is important for library code, which may contain code to log events. If a user of the library does not configure logging, the one-off warning might be produced; to avoid this, the library developer simply needs to instantiate a NullHandler and add it to the top-level logger of the library module or package.

Initializes the instance - basically setting the formatter to None and the filter list to empty.

NullHandler(name, parent, **kwargs)