diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-01-07 23:52:19 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-01-10 11:47:27 +0000 |
commit | cf4a309cce7e4f637799f3df6c37172db1d62ae9 (patch) | |
tree | 7ea2a812a18aff3dda4c2d5582e22d7b460b6612 /lib | |
parent | 2d97dedfb92b0d75e757dced705c7e037ef15e3a (diff) | |
download | bitbake-cf4a309cce7e4f637799f3df6c37172db1d62ae9.tar.gz |
bitbake/__init__.py: Add taskpid to all LogRecords (subclassed to be BBLogRecords)
This allows us to identify which task messages are from.
(From Poky rev: f8e7215f6c4ece8c0a74ceee8da707cf791038e8)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bb/__init__.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/bb/__init__.py b/lib/bb/__init__.py index 3e75abd28..077c28a77 100644 --- a/lib/bb/__init__.py +++ b/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) |