X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FFilteredLogger.py;h=3df57148373b6535312247a2aee14f0ac74001a1;hp=a04eb674761c7dd55e26e0667cd88fa69280895f;hb=d68951ac245150eeefa6e0f4156e4c1b5c9e9325;hpb=ed0258a440cfad7023d643f717ab78ac568dc59b 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")