From 760b82e7320ce5dbf295df6811b04bd0594fd516 Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Fri, 17 Dec 2010 11:49:31 -0700 Subject: Fix logging level names for post-server-ui-split (Bitbake rev: dc5a5c39291ec223cd761dce59d29eee7316cb70) Signed-off-by: Chris Larson Signed-off-by: Richard Purdie --- bitbake/lib/bb/msg.py | 21 +++++++++++++++++++++ bitbake/lib/bb/ui/knotty.py | 10 ---------- 2 files changed, 21 insertions(+), 10 deletions(-) (limited to 'bitbake/lib') diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py index 36d7060b1c..badc371ce1 100644 --- a/bitbake/lib/bb/msg.py +++ b/bitbake/lib/bb/msg.py @@ -33,7 +33,28 @@ import bb.event class BBLogFormatter(logging.Formatter): """Formatter which ensures that our 'plain' messages (logging.INFO + 1) are used as is""" + VERBOSE = 19 + PLAIN = 21 + levelnames = { + PLAIN : '', + VERBOSE: 'NOTE', + + logging.DEBUG : 'DEBUG', + logging.INFO : 'NOTE', + logging.WARNING : 'WARNING', + logging.ERROR : 'ERROR', + logging.CRITICAL: 'ERROR', + } + + def getLevelName(self, levelno): + try: + return self.levelnames[levelno] + except KeyError: + self.levelnames[levelno] = value = 'Level %d' % levelno + return value + def format(self, record): + record.levelname = self.getLevelName(record.levelno) if record.levelno == logging.INFO + 1: return record.getMessage() else: diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index b9ad34f16a..cedbe42306 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py @@ -74,16 +74,6 @@ def main(server, eventHandler): helper = uihelper.BBUIHelper() - # Set up logging to stdout in our usual format - logging.addLevelName(logging.INFO, "NOTE") - logging.addLevelName(logging.CRITICAL, "FATAL") - - for level in xrange(logging.INFO - 1, logging.DEBUG + 1, -1): - logging.addLevelName(level, logging.getLevelName(logging.INFO)) - - for level in xrange(logging.DEBUG - 1, 0, -1): - logging.addLevelName(level, logging.getLevelName(logging.DEBUG)) - console = logging.StreamHandler(sys.stdout) format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") console.setFormatter(format) -- cgit v1.2.3-54-g00ecf