forked from LBRYCommunity/lbry-sdk
fixup logging some more
This commit is contained in:
parent
c7430f4ae9
commit
f4ef92e653
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