diff options
| author | Chris Larson <chris_larson@mentor.com> | 2010-12-17 11:49:31 -0700 |
|---|---|---|
| committer | Richard Purdie <rpurdie@linux.intel.com> | 2011-01-04 14:46:52 +0000 |
| commit | 760b82e7320ce5dbf295df6811b04bd0594fd516 (patch) | |
| tree | af6cc359efc9380cde07d40e7c344a11c6cb60ea | |
| parent | 93e20c51c4cbb345119b83a964409932af417df3 (diff) | |
| download | poky-760b82e7320ce5dbf295df6811b04bd0594fd516.tar.gz | |
Fix logging level names for post-server-ui-split
(Bitbake rev: dc5a5c39291ec223cd761dce59d29eee7316cb70)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
| -rw-r--r-- | bitbake/lib/bb/msg.py | 21 | ||||
| -rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 10 |
2 files changed, 21 insertions, 10 deletions
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 | |||
| 33 | class BBLogFormatter(logging.Formatter): | 33 | class BBLogFormatter(logging.Formatter): |
| 34 | """Formatter which ensures that our 'plain' messages (logging.INFO + 1) are used as is""" | 34 | """Formatter which ensures that our 'plain' messages (logging.INFO + 1) are used as is""" |
| 35 | 35 | ||
| 36 | VERBOSE = 19 | ||
| 37 | PLAIN = 21 | ||
| 38 | levelnames = { | ||
| 39 | PLAIN : '', | ||
| 40 | VERBOSE: 'NOTE', | ||
| 41 | |||
| 42 | logging.DEBUG : 'DEBUG', | ||
| 43 | logging.INFO : 'NOTE', | ||
| 44 | logging.WARNING : 'WARNING', | ||
| 45 | logging.ERROR : 'ERROR', | ||
| 46 | logging.CRITICAL: 'ERROR', | ||
| 47 | } | ||
| 48 | |||
| 49 | def getLevelName(self, levelno): | ||
| 50 | try: | ||
| 51 | return self.levelnames[levelno] | ||
| 52 | except KeyError: | ||
| 53 | self.levelnames[levelno] = value = 'Level %d' % levelno | ||
| 54 | return value | ||
| 55 | |||
| 36 | def format(self, record): | 56 | def format(self, record): |
| 57 | record.levelname = self.getLevelName(record.levelno) | ||
| 37 | if record.levelno == logging.INFO + 1: | 58 | if record.levelno == logging.INFO + 1: |
| 38 | return record.getMessage() | 59 | return record.getMessage() |
| 39 | else: | 60 | 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): | |||
| 74 | 74 | ||
| 75 | helper = uihelper.BBUIHelper() | 75 | helper = uihelper.BBUIHelper() |
| 76 | 76 | ||
| 77 | # Set up logging to stdout in our usual format | ||
| 78 | logging.addLevelName(logging.INFO, "NOTE") | ||
| 79 | logging.addLevelName(logging.CRITICAL, "FATAL") | ||
| 80 | |||
| 81 | for level in xrange(logging.INFO - 1, logging.DEBUG + 1, -1): | ||
| 82 | logging.addLevelName(level, logging.getLevelName(logging.INFO)) | ||
| 83 | |||
| 84 | for level in xrange(logging.DEBUG - 1, 0, -1): | ||
| 85 | logging.addLevelName(level, logging.getLevelName(logging.DEBUG)) | ||
| 86 | |||
| 87 | console = logging.StreamHandler(sys.stdout) | 77 | console = logging.StreamHandler(sys.stdout) |
| 88 | format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") | 78 | format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") |
| 89 | console.setFormatter(format) | 79 | console.setFormatter(format) |
