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>
This commit is contained in:
parent
a13352cfaf
commit
f8e7215f6c
|
@ -35,6 +35,11 @@ class NullHandler(logging.Handler):
|
||||||
def emit(self, record):
|
def emit(self, record):
|
||||||
pass
|
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()
|
Logger = logging.getLoggerClass()
|
||||||
class BBLogger(Logger):
|
class BBLogger(Logger):
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
|
@ -42,6 +47,9 @@ class BBLogger(Logger):
|
||||||
self.debug = self.bbdebug
|
self.debug = self.bbdebug
|
||||||
Logger.__init__(self, name)
|
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):
|
def bbdebug(self, level, msg, *args, **kwargs):
|
||||||
return self.log(logging.DEBUG - level - 1, msg, *args, **kwargs)
|
return self.log(logging.DEBUG - level - 1, msg, *args, **kwargs)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue