From 0eb45de95c08a189b997b3af307bedb4407769b5 Mon Sep 17 00:00:00 2001 From: Julien Thewys Date: Thu, 1 Apr 2010 21:17:49 +0200 Subject: [PATCH] [FIX] Removed ANSI output in logging level. ANSI output changed the builtin log level name. This actually broke tests as we rely on the log level name for assertion report. See comments for indications to a more appropriate implementation. bzr revid: jth@openerp.com-20100401191749-j562qu28o0a066m1 --- bin/netsvc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/netsvc.py b/bin/netsvc.py index 475bbc33ba7..6aaff59ead3 100644 --- a/bin/netsvc.py +++ b/bin/netsvc.py @@ -205,7 +205,10 @@ def init_logger(): for level, (fg, bg) in mapping.items(): msg = "\x1b[%dm\x1b[%dm%s\x1b[0m" % (foreground(fg), background(bg), level) - logging.addLevelName(getattr(logging, level), msg) +# jth: we should not override default level name +# jth: use this instead http://stackoverflow.com/questions/384076/how-can-i-make-the-python-logging-output-to-be-colored +# jth: also, do not output ANSI if terminal doesn't support it (test it in Eclipse console and on windows) + #logging.addLevelName(getattr(logging, level), msg) class Logger(object):