diff options
author | Jan Gelety <jgelety@cisco.com> | 2019-11-12 05:27:43 +0100 |
---|---|---|
committer | Jan Gelety <jgelety@cisco.com> | 2019-11-28 18:26:21 +0100 |
commit | d68951ac245150eeefa6e0f4156e4c1b5c9e9325 (patch) | |
tree | 487554a7547218d27f0a61ec02b70502c32cdcb4 /resources/libraries/python/FilteredLogger.py | |
parent | ed0258a440cfad7023d643f717ab78ac568dc59b (diff) |
Python3: resources and libraries
Change-Id: I1392c06b1d64f62b141d24c0d42a8e36913b15e2
Signed-off-by: Jan Gelety <jgelety@cisco.com>
Diffstat (limited to 'resources/libraries/python/FilteredLogger.py')
-rw-r--r-- | resources/libraries/python/FilteredLogger.py | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/resources/libraries/python/FilteredLogger.py b/resources/libraries/python/FilteredLogger.py index a04eb67476..3df5714837 100644 --- a/resources/libraries/python/FilteredLogger.py +++ b/resources/libraries/python/FilteredLogger.py @@ -26,17 +26,18 @@ Logger.console() is not supported. import logging _LEVELS = { - "TRACE": logging.DEBUG // 2, - "DEBUG": logging.DEBUG, - "INFO": logging.INFO, - "HTML": logging.INFO, - "WARN": logging.WARN, - "ERROR": logging.ERROR, - "CRITICAL": logging.CRITICAL, - "NONE": logging.CRITICAL, + u"TRACE": logging.DEBUG // 2, + u"DEBUG": logging.DEBUG, + u"INFO": logging.INFO, + u"HTML": logging.INFO, + u"WARN": logging.WARN, + u"ERROR": logging.ERROR, + u"CRITICAL": logging.CRITICAL, + u"NONE": logging.CRITICAL, } -class FilteredLogger(object): + +class FilteredLogger: """Instances of this class have the similar API to robot.api.logger. TODO: Support html argument? @@ -57,7 +58,7 @@ class FilteredLogger(object): self.logger_module = logger_module self.min_level_num = _LEVELS[min_level.upper()] - def write(self, message, farg=None, level="INFO"): + def write(self, message, farg=None, level=u"INFO"): """Forwards the message to logger if min_level is reached. Formatting using '%' operator is used when farg argument is suplied. @@ -76,20 +77,20 @@ class FilteredLogger(object): def trace(self, message, farg=None): """Forward the message using the ``TRACE`` level.""" - self.write(message, farg=farg, level="TRACE") + self.write(message, farg=farg, level=u"TRACE") def debug(self, message, farg=None): """Forward the message using the ``DEBUG`` level.""" - self.write(message, farg=farg, level="DEBUG") + self.write(message, farg=farg, level=u"DEBUG") def info(self, message, farg=None): """Forward the message using the ``INFO`` level.""" - self.write(message, farg=farg, level="INFO") + self.write(message, farg=farg, level=u"INFO") def warn(self, message, farg=None): """Forward the message using the ``WARN`` level.""" - self.write(message, farg=farg, level="WARN") + self.write(message, farg=farg, level=u"WARN") def error(self, message, farg=None): """Forward the message using the ``ERROR`` level.""" - self.write(message, farg=farg, level="ERROR") + self.write(message, farg=farg, level=u"ERROR") |