Coverage for /media/ldata/code/tendril/tendril/utils/log.py : 94%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# Copyright (C) 2015 Chintalagiri Shashank # # This file is part of Tendril. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. The Log Utils Module (:mod:`tendril.utils.log`) ===============================================
This module provides utilities to deal with logging systems. The intent of having this module instead of using :mod:`logging` directly is to allow the injection of various default parameters and options into all the loggers used from a central place, instead of littering them throughout the modules.
At present, this module does nothing that is overly useful, except for being able to set the default log level for all modules simultaneously.
.. rubric:: Usage Example
>>> from tendril.utils import log >>> logger = log.get_logger(__name__, log.DEFAULT)
"""
#: Level for debug entries. High volume is ok #: Level for informational entires. Low volume #: Warnings only, which inform of possible failure #: Errors only, which inform of high likelihood of failure #: Critical Errors, things which should halt execution entirely
#: The default log level for all loggers created through this module, #: unless otherwise specified at the time of instantiation.
""" Get a logger with the specified ``name`` and an optional ``level``.
The levels from the python :mod:`logging` module can be used directly. For convenience, these levels are imported into this module's namespace as well, along with the :data:`DEFAULT` level this module provides.
See python :mod:`logging` documentation for information about log levels.
:param name: The name of the logger :type name: str :param level: Log level of the logger to be used. Default : :data:`DEFAULT`. :type level: int :return: The logger instance """ else: logger.setLevel(DEFAULT)
|