[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
This commit is contained in:
Julien Thewys 2010-04-01 21:17:49 +02:00
parent 41fc8c369a
commit 0eb45de95c
1 changed files with 4 additions and 1 deletions

View File

@ -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):