summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/build.py14
-rw-r--r--bitbake/lib/bb/msg.py9
-rw-r--r--bitbake/lib/bb/ui/knotty.py12
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
29import sys 29import sys
30import logging 30import logging
31import bb 31import bb
32import bb.msg
32import bb.utils 33import bb.utils
33import bb.process 34import bb.process
34from contextlib import nested 35from contextlib import nested
35from bb import data, event, mkdirhier, utils 36from bb import data, event, mkdirhier, utils
36 37
37logger = logging.getLogger("BitBake.Build") 38bblogger = logging.getLogger('BitBake')
39logger = logging.getLogger('BitBake.Build')
38 40
39NULL = open('/dev/null', 'r') 41NULL = 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") 169logformatter = bb.msg.BBLogFormatter("%(levelname)s: %(message)s")
168def exec_func_python(func, d, runfile, logfile, cwd=None): 170def 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
30import bb 30import bb
31import bb.event 31import bb.event
32 32
33class 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
33class Loggers(dict): 42class 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
26import xmlrpclib 26import xmlrpclib
27import logging 27import logging
28import progressbar 28import progressbar
29import bb.msg
29from bb import ui 30from bb import ui
30from bb.ui import uihelper 31from 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
60class 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
69def main(server, eventHandler): 61def 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