Minor updates to log.py

This commit is contained in:
Serg 2019-02-09 20:05:51 +03:00 committed by Calum Lind
parent 827987fe7d
commit 515dbcc5d9
1 changed files with 6 additions and 5 deletions

View File

@ -142,8 +142,8 @@ def setup_logger(
""" """
if logging.getLoggerClass() is not Logging: if logging.getLoggerClass() is not Logging:
logging.setLoggerClass(Logging) logging.setLoggerClass(Logging)
logging.addLevelName(5, 'TRACE') logging.addLevelName(levels['trace'], 'TRACE')
logging.addLevelName(1, 'GARBAGE') logging.addLevelName(levels['garbage'], 'GARBAGE')
level = levels.get(level, logging.ERROR) level = levels.get(level, logging.ERROR)
@ -253,8 +253,8 @@ def set_logger_level(level, logger_name=None):
:param level: str, a string representing the desired level :param level: str, a string representing the desired level
:param logger_name: str, a string representing desired logger name for which :param logger_name: str, a string representing desired logger name for which
the level should change. The default is "None" will will the level should change. The default is "None" will tweak
tweak the root logger level. the root logger level.
""" """
logging.getLogger(logger_name).setLevel(levels.get(level, 'error')) logging.getLogger(logger_name).setLevel(levels.get(level, 'error'))
@ -302,7 +302,8 @@ If you're the developer, please stop using the above code and instead use:
The above will result in, regarding the "Label" plugin for example a log message similar to: The above will result in, regarding the "Label" plugin for example a log message similar to:
15:33:54 [deluge.plugins.label.core:78 ][INFO ] *** Start Label plugin *** 15:33:54 [deluge.plugins.label.core:78 ][INFO ] *** Start Label plugin ***
Triggering code:""" Triggering code:
"""
class _BackwardsCompatibleLOG(object): class _BackwardsCompatibleLOG(object):