fixup logging some more
This commit is contained in:
parent
ff31ddd2d5
commit
f9ed9a4505
2 changed files with 4 additions and 6 deletions
|
@ -1,8 +1,2 @@
|
|||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
logging.getLogger(__name__).addHandler(logging.NullHandler())
|
||||
log.setLevel(logging.INFO)
|
||||
|
||||
__version__ = "0.3.17"
|
||||
version = tuple(__version__.split('.'))
|
|
@ -55,6 +55,10 @@ def _log_decorator(fn):
|
|||
def helper(*args, **kwargs):
|
||||
log = kwargs.pop('log', logging.getLogger())
|
||||
level = kwargs.pop('level', logging.INFO)
|
||||
if not isinstance(level, int):
|
||||
# despite the name, getLevelName returns
|
||||
# the numeric level when passed a text level
|
||||
level = logging.getLevelName(level)
|
||||
handler = fn(*args, **kwargs)
|
||||
if handler.name:
|
||||
remove_handlers(log, handler.name)
|
||||
|
|
Loading…
Reference in a new issue