diff --git a/gns3server/web/logger.py b/gns3server/web/logger.py index 09af48df..0c6575e4 100644 --- a/gns3server/web/logger.py +++ b/gns3server/web/logger.py @@ -34,7 +34,7 @@ class ColouredFormatter(logging.Formatter): message = super().format(record) if not colour: - return message + return message.replace("#RESET#", "") level_no = record.levelno if level_no >= logging.CRITICAL: @@ -50,6 +50,7 @@ class ColouredFormatter(logging.Formatter): else: colour = self.RESET + message = message.replace("#RESET#", self.RESET) message = '{colour}{message}{reset}'.format(colour=colour, message=message, reset=self.RESET) return message @@ -76,7 +77,7 @@ class ColouredStreamHandler(logging.StreamHandler): def init_logger(level,quiet=False): stream_handler = ColouredStreamHandler(sys.stdout) - stream_handler.formatter = ColouredFormatter("{asctime} {levelname:8} {filename}:{lineno} {message}", "%Y-%m-%d %H:%M:%S", "{") + stream_handler.formatter = ColouredFormatter("{asctime} {levelname:8} {filename}:{lineno}#RESET# {message}", "%Y-%m-%d %H:%M:%S", "{") if quiet: stream_handler.addFilter(logging.Filter(name="user_facing")) logging.getLogger('user_facing').propagate = False