From d3a45c7d41a88d79389fc40eb68816e4939fb6f9 Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Thu, 10 Jun 2010 08:05:52 -0700 Subject: Use logging in the knotty ui, and pass the log record across directly This kills firing of Msg* events in favor of just passing along LogRecord objects. These objects hold more than just level and message, but can also have exception information, so the UI can decide what to do with that. As an aside, when using the 'none' server, this results in the log messages in the server being displayed directly via the logging module and the UI's handler, rather than going through the server's event queue. As a result of doing it this way, we have to override the event handlers of the base logger when spawning a worker process, to ensure they log via events rather than directly. (Bitbake rev: c23c015cf8af1868faf293b19b80a5faf7e736a5) Signed-off-by: Chris Larson Signed-off-by: Richard Purdie --- bitbake/lib/bb/event.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'bitbake/lib/bb/event.py') diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index c04ffd5ac1..3fb9ff5bfc 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py @@ -328,20 +328,8 @@ class MsgPlain(MsgBase): class LogHandler(logging.Handler): """Dispatch logging messages as bitbake events""" - messages = ( - (logging.DEBUG, MsgDebug), - (logging.INFO, MsgNote), - (logging.WARNING, MsgWarn), - (logging.ERROR, MsgError), - (logging.CRITICAL, MsgFatal), - ) - def emit(self, record): - for level, msgclass in self.messages: - if record.levelno <= level: - msg = self.format(record) - fire(msgclass(msg), None) - if bb.event.useStdout: - print(record.levelname + ": " + record.getMessage()) - break + fire(record, None) + if bb.event.useStdout: + print(self.format(record)) -- cgit v1.2.3-54-g00ecf