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 import sys import logging import bb +import bb.msg import bb.utils import bb.process from contextlib import nested from bb import data, event, mkdirhier, utils -logger = logging.getLogger("BitBake.Build") +bblogger = logging.getLogger('BitBake') +logger = logging.getLogger('BitBake.Build') NULL = open('/dev/null', 'r') @@ -164,7 +166,7 @@ def {function}(d): {function}(d) """ -#logformatter = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") +logformatter = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") def exec_func_python(func, d, runfile, logfile, cwd=None): """Execute a python BB 'function'""" @@ -181,9 +183,9 @@ def exec_func_python(func, d, runfile, logfile, cwd=None): if cwd: os.chdir(cwd) - #handler = logging.StreamHandler(logfile) - #handler.setFormatter(logformatter) - #bblogger.addHandler(handler) + handler = logging.StreamHandler(logfile) + handler.setFormatter(logformatter) + bblogger.addHandler(handler) try: comp = utils.better_compile(code, func, bbfile) @@ -194,7 +196,7 @@ def exec_func_python(func, d, runfile, logfile, cwd=None): raise FuncFailed(func, None) finally: - #bblogger.removeHandler(handler) + bblogger.removeHandler(handler) if olddir: os.chdir(olddir) 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 import bb import bb.event +class BBLogFormatter(logging.Formatter): + """Formatter which ensures that our 'plain' messages (logging.INFO + 1) are used as is""" + + def format(self, record): + if record.levelno == logging.INFO + 1: + return record.getMessage() + else: + return logging.Formatter.format(self, record) + class Loggers(dict): def __getitem__(self, key): 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 import xmlrpclib import logging import progressbar +import bb.msg from bb import ui from bb.ui import uihelper @@ -57,15 +58,6 @@ class NonInteractiveProgress(object): self.fobj.write("done.\n") self.fobj.flush() -class BBLogFormatter(logging.Formatter): - """Formatter which ensures that our 'plain' messages (logging.INFO + 1) are used as is""" - - def format(self, record): - if record.levelno == logging.INFO + 1: - return record.getMessage() - else: - return logging.Formatter.format(self, record) - def main(server, eventHandler): # Get values of variables which control our output @@ -85,7 +77,7 @@ def main(server, eventHandler): logging.addLevelName(level, logging.getLevelName(logging.DEBUG)) console = logging.StreamHandler(sys.stdout) - format = BBLogFormatter("%(levelname)s: %(message)s") + format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") console.setFormatter(format) logger.addHandler(console) |