summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/__init__.py
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/__init__.py
parenta13352cfaf4b5d19196151e362851b1516e6af15 (diff)
downloadpoky-f8e7215f6c4ece8c0a74ceee8da707cf791038e8.tar.gz
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/__init__.py')
-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 f8577c6794..9c57c65f8d 100644
--- a/bitbake/lib/bb/__init__.py
+++ b/bitbake/lib/bb/__init__.py
@@ -35,6 +35,11 @@ class NullHandler(logging.Handler):
35 def emit(self, record): 35 def emit(self, record):
36 pass 36 pass
37 37
38class BBLogRecord(logging.LogRecord):
39 def __init__(self, name, level, fn, lno, msg, args, exc_info, func, extra):
40 self.taskpid = bb.event.worker_pid
41 logging.LogRecord.__init__(self, name, level, fn, lno, msg, args, exc_info, func)
42
38Logger = logging.getLoggerClass() 43Logger = logging.getLoggerClass()
39class BBLogger(Logger): 44class BBLogger(Logger):
40 def __init__(self, name): 45 def __init__(self, name):
@@ -42,6 +47,9 @@ class BBLogger(Logger):
42 self.debug = self.bbdebug 47 self.debug = self.bbdebug
43 Logger.__init__(self, name) 48 Logger.__init__(self, name)
44 49
50 def makeRecord(self, name, lvl, fn, lno, msg, args, exc_info, func=None, extra=None):
51 return BBLogRecord(name, lvl, fn, lno, msg, args, exc_info, func, extra)
52
45 def bbdebug(self, level, msg, *args, **kwargs): 53 def bbdebug(self, level, msg, *args, **kwargs):
46 return self.log(logging.DEBUG - level - 1, msg, *args, **kwargs) 54 return self.log(logging.DEBUG - level - 1, msg, *args, **kwargs)
47 55