summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/bb/build.py1
-rw-r--r--lib/bb/utils.py11
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/bb/build.py b/lib/bb/build.py
index 7a7aabb853a..0c2c1ba1262 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -562,6 +562,7 @@ def _exec_task(fn, task, d, quieterr):
localdata.setVar('BB_LOGFILE', logfn)
localdata.setVar('BB_RUNTASK', task)
+ localdata.setVar('BB_TASK_LOGGER', bblogger)
flags = localdata.getVarFlags(task)
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 9073f15ea24..a22a05e2414 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -1503,3 +1503,14 @@ def load_plugins(logger, plugins, pluginpath):
plugins.append(obj or plugin)
else:
plugins.append(plugin)
+
+
+class LogCatcher(logging.Handler):
+ """Logging handler for collecting logged messages so you can check them later"""
+ def __init__(self):
+ self.messages = []
+ logging.Handler.__init__(self, logging.WARNING)
+ def emit(self, record):
+ self.messages.append(bb.build.logformatter.format(record))
+ def contains(self, message):
+ return (message in self.messages)