diff options
-rw-r--r-- | bitbake/lib/bb/build.py | 14 | ||||
-rw-r--r-- | bitbake/lib/bb/msg.py | 9 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 12 |
3 files changed, 19 insertions, 16 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index 5d07b06640..e4e767ebc1 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py | |||
@@ -29,12 +29,14 @@ import os | |||
29 | import sys | 29 | import sys |
30 | import logging | 30 | import logging |
31 | import bb | 31 | import bb |
32 | import bb.msg | ||
32 | import bb.utils | 33 | import bb.utils |
33 | import bb.process | 34 | import bb.process |
34 | from contextlib import nested | 35 | from contextlib import nested |
35 | from bb import data, event, mkdirhier, utils | 36 | from bb import data, event, mkdirhier, utils |
36 | 37 | ||
37 | logger = logging.getLogger("BitBake.Build") | 38 | bblogger = logging.getLogger('BitBake') |
39 | logger = logging.getLogger('BitBake.Build') | ||
38 | 40 | ||
39 | NULL = open('/dev/null', 'r') | 41 | NULL = open('/dev/null', 'r') |
40 | 42 | ||
@@ -164,7 +166,7 @@ def {function}(d): | |||
164 | 166 | ||
165 | {function}(d) | 167 | {function}(d) |
166 | """ | 168 | """ |
167 | #logformatter = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") | 169 | logformatter = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") |
168 | def exec_func_python(func, d, runfile, logfile, cwd=None): | 170 | def exec_func_python(func, d, runfile, logfile, cwd=None): |
169 | """Execute a python BB 'function'""" | 171 | """Execute a python BB 'function'""" |
170 | 172 | ||
@@ -181,9 +183,9 @@ def exec_func_python(func, d, runfile, logfile, cwd=None): | |||
181 | if cwd: | 183 | if cwd: |
182 | os.chdir(cwd) | 184 | os.chdir(cwd) |
183 | 185 | ||
184 | #handler = logging.StreamHandler(logfile) | 186 | handler = logging.StreamHandler(logfile) |
185 | #handler.setFormatter(logformatter) | 187 | handler.setFormatter(logformatter) |
186 | #bblogger.addHandler(handler) | 188 | bblogger.addHandler(handler) |
187 | 189 | ||
188 | try: | 190 | try: |
189 | comp = utils.better_compile(code, func, bbfile) | 191 | comp = utils.better_compile(code, func, bbfile) |
@@ -194,7 +196,7 @@ def exec_func_python(func, d, runfile, logfile, cwd=None): | |||
194 | 196 | ||
195 | raise FuncFailed(func, None) | 197 | raise FuncFailed(func, None) |
196 | finally: | 198 | finally: |
197 | #bblogger.removeHandler(handler) | 199 | bblogger.removeHandler(handler) |
198 | if olddir: | 200 | if olddir: |
199 | os.chdir(olddir) | 201 | os.chdir(olddir) |
200 | 202 | ||
diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py index b876219da6..36d7060b1c 100644 --- a/bitbake/lib/bb/msg.py +++ b/bitbake/lib/bb/msg.py | |||
@@ -30,6 +30,15 @@ import warnings | |||
30 | import bb | 30 | import bb |
31 | import bb.event | 31 | import bb.event |
32 | 32 | ||
33 | class BBLogFormatter(logging.Formatter): | ||
34 | """Formatter which ensures that our 'plain' messages (logging.INFO + 1) are used as is""" | ||
35 | |||
36 | def format(self, record): | ||
37 | if record.levelno == logging.INFO + 1: | ||
38 | return record.getMessage() | ||
39 | else: | ||
40 | return logging.Formatter.format(self, record) | ||
41 | |||
33 | class Loggers(dict): | 42 | class Loggers(dict): |
34 | def __getitem__(self, key): | 43 | def __getitem__(self, key): |
35 | if key in self: | 44 | if key in self: |
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 | ||