[oe-commits] [bitbake] 01/03: cooker/knotty: Prefix parse logs with filename being parsed
git at git.openembedded.org
git at git.openembedded.org
Thu Apr 14 13:56:50 UTC 2016
rpurdie pushed a commit to branch master-next
in repository bitbake.
commit 1af0ccaac81e182c4ca520037dda362d180e5605
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Thu Apr 14 14:29:27 2016 +0100
cooker/knotty: Prefix parse logs with filename being parsed
We now prefix log messages coming from worker task context with the
PF and task info, however parsing messages all have to be manually
prefixed which is ugly and error prone. This change modifies the log
handler filter so this happens automatically, meaning we don't have
to change every message to include that information. This makes error
messages longer but more usable.
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
lib/bb/cooker.py | 8 ++++++++
lib/bb/ui/knotty.py | 3 ++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 4068b8f..9b565fc 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -1970,9 +1970,17 @@ class Parser(multiprocessing.Process):
def parse(self, filename, appends, caches_array):
try:
+ # Record the filename we're parsing into any events generated
+ def parse_filter(self, record):
+ record.taskpid = bb.event.worker_pid
+ record.fn = filename
+ return True
+
# Reset our environment and handlers to the original settings
bb.utils.set_context(self.context.copy())
bb.event.set_class_handlers(self.handlers.copy())
+ bb.event.LogHandler.filter = parse_filter
+
return True, bb.cache.Cache.parse(filename, appends, self.cfg, caches_array)
except Exception as exc:
tb = sys.exc_info()[2]
diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index dff92bc..2fc20cf 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -371,7 +371,8 @@ def main(server, eventHandler, params, tf = TerminalFilter):
if event.taskpid in helper.running_tasks:
taskinfo = helper.running_tasks[event.taskpid]
event.msg = taskinfo['title'] + ': ' + event.msg
-
+ if hasattr(event, 'fn'):
+ event.msg = event.fn + ': ' + event.msg
logger.handle(event)
continue
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list