diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-12-09 23:38:35 -0500 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2011-01-04 14:46:48 +0000 |
commit | aaa55880ac79f470e613130baefdf317a764cbf2 (patch) | |
tree | 9ce5da72131cd6087afad976f51ab73457d201e4 /bitbake/lib/bb/ui/knotty.py | |
parent | 25e519a80fc453de1468823b2bf26ab053aa0dca (diff) | |
download | poky-aaa55880ac79f470e613130baefdf317a764cbf2.tar.gz |
build: send logging messages to the log file for python functions
(Bitbake rev: ee1cce6ab21ddda60a7a070d03e98ff8485a5e71)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/ui/knotty.py')
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 9385883ea9..e0f08ecb6e 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
@@ -26,6 +26,7 @@ import itertools | |||
26 | import xmlrpclib | 26 | import xmlrpclib |
27 | import logging | 27 | import logging |
28 | import progressbar | 28 | import progressbar |
29 | import bb.msg | ||
29 | from bb import ui | 30 | from bb import ui |
30 | from bb.ui import uihelper | 31 | from bb.ui import uihelper |
31 | 32 | ||
@@ -57,15 +58,6 @@ class NonInteractiveProgress(object): | |||
57 | self.fobj.write("done.\n") | 58 | self.fobj.write("done.\n") |
58 | self.fobj.flush() | 59 | self.fobj.flush() |
59 | 60 | ||
60 | class BBLogFormatter(logging.Formatter): | ||
61 | """Formatter which ensures that our 'plain' messages (logging.INFO + 1) are used as is""" | ||
62 | |||
63 | def format(self, record): | ||
64 | if record.levelno == logging.INFO + 1: | ||
65 | return record.getMessage() | ||
66 | else: | ||
67 | return logging.Formatter.format(self, record) | ||
68 | |||
69 | def main(server, eventHandler): | 61 | def main(server, eventHandler): |
70 | 62 | ||
71 | # Get values of variables which control our output | 63 | # Get values of variables which control our output |
@@ -85,7 +77,7 @@ def main(server, eventHandler): | |||
85 | logging.addLevelName(level, logging.getLevelName(logging.DEBUG)) | 77 | logging.addLevelName(level, logging.getLevelName(logging.DEBUG)) |
86 | 78 | ||
87 | console = logging.StreamHandler(sys.stdout) | 79 | console = logging.StreamHandler(sys.stdout) |
88 | format = BBLogFormatter("%(levelname)s: %(message)s") | 80 | format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") |
89 | console.setFormatter(format) | 81 | console.setFormatter(format) |
90 | logger.addHandler(console) | 82 | logger.addHandler(console) |
91 | 83 | ||