From f8e7215f6c4ece8c0a74ceee8da707cf791038e8 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 7 Jan 2011 23:52:19 +0000 Subject: 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 --- bitbake/lib/bb/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'bitbake/lib/bb/__init__.py') 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) -- cgit v1.2.3