From 0b97509a741d97a9e2cfe65e38f977d16c17fa0f Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Tue, 20 Jan 2015 15:18:57 +0100 Subject: [PATCH] Do not color logger message --- gns3server/web/logger.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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