@cryptotaxi247 / netdata-1 / commits / c5983373b

logger fix for py2.6 (severity must be numeric)

lgz committed Oct 27, 2017 at 21:23 UTC c5983373b6bbf17558e33cd44b03e9f8ca852cc6
1 file changed +8 -8
python.d/python_modules/bases/loggers.py
+8 -8
@@ -15,12 +15,12 @@ except ImportError:
15 from bases.collection import on_try_except_finally
16
17
18 -LOGGING_LEVELS = {50: 'CRITICAL',
19 - 40: 'ERROR',
20 - 30: 'WARNING',
21 - 20: 'INFO',
22 - 10: 'DEBUG',
23 - 0: 'NOTSET'}
18 +LOGGING_LEVELS = {'CRITICAL': 50,
19 + 'ERROR': 40,
20 + 'WARNING': 30,
21 + 'INFO': 20,
22 + 'DEBUG': 10,
23 + 'NOTSET': 0}
24
25 DEFAULT_LOG_LINE_FORMAT = '%(asctime)s: %(name)s %(levelname)s : %(message)s'
26 DEFAULT_LOG_TIME_FORMAT = '%Y-%m-%d %H:%M:%S'
@@ -116,8 +116,8 @@ class BaseLogger(object):
116 :param level: <str> or <int>
117 :return:
118 """
119 - if level in [lvl for item in LOGGING_LEVELS.items() for lvl in item]:
120 - self.logger.setLevel(level)
119 + if level in LOGGING_LEVELS:
120 + self.logger.setLevel(LOGGING_LEVELS[level])
121
122 def debug(self, *msg, **kwargs):
123 self.logger.debug(' '.join(map(str, msg)), **kwargs)