summaryrefslogtreecommitdiff
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-01-07 23:52:19 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-01-08 00:02:00 +0000
commitf8e7215f6c4ece8c0a74ceee8da707cf791038e8 (patch)
treef74f02bac0121fcd0dc86642769edc7c1c1151a9 /bitbake/lib/bb
parenta13352cfaf4b5d19196151e362851b1516e6af15 (diff)
downloadopenembedded-core-f8e7215f6c4ece8c0a74ceee8da707cf791038e8.tar.gz
openembedded-core-f8e7215f6c4ece8c0a74ceee8da707cf791038e8.tar.bz2
openembedded-core-f8e7215f6c4ece8c0a74ceee8da707cf791038e8.tar.xz
openembedded-core-f8e7215f6c4ece8c0a74ceee8da707cf791038e8.zip
bitbake/__init__.py: Add taskpid to all LogRecords (subclassed to be BBLogRecords)
This allows us to identify which task messages are from. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/__init__.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py
index f8577c679..9c57c65f8 100644
--- a/bitbake/lib/bb/__init__.py
+++ b/bitbake/lib/bb/__init__.py
@@ -35,6 +35,11 @@ class NullHandler(logging.Handler):
def emit(self, record):
pass
+class BBLogRecord(logging.LogRecord):
+ def __init__(self, name, level, fn, lno, msg, args, exc_info, func, extra):
+ self.taskpid = bb.event.worker_pid
+ logging.LogRecord.__init__(self, name, level, fn, lno, msg, args, exc_info, func)
+
Logger = logging.getLoggerClass()
class BBLogger(Logger):
def __init__(self, name):
@@ -42,6 +47,9 @@ class BBLogger(Logger):
self.debug = self.bbdebug
Logger.__init__(self, name)
+ def makeRecord(self, name, lvl, fn, lno, msg, args, exc_info, func=None, extra=None):
+ return BBLogRecord(name, lvl, fn, lno, msg, args, exc_info, func, extra)
+
def bbdebug(self, level, msg, *args, **kwargs):
return self.log(logging.DEBUG - level - 1, msg, *args, **kwargs)