mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 00:20:08 +00:00
Shift traceback pre-formatting into LogHandler
It's cleaner to leave it behaving as usual, passing the exception data in the exc_info attribute of the LogRecord where it normally lies, and then let LogHandler make it pickleable so it can be sent to the UI. (Bitbake rev: 3539c9474a0b53f57e614544c70a7197ecdfb130) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
355338c40c
commit
95f02a2ab1
@@ -29,7 +29,7 @@ if sys.version_info < (2, 6, 0):
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import traceback
|
|
||||||
|
|
||||||
class NullHandler(logging.Handler):
|
class NullHandler(logging.Handler):
|
||||||
def emit(self, record):
|
def emit(self, record):
|
||||||
@@ -51,9 +51,6 @@ class BBLogger(Logger):
|
|||||||
def verbose(self, msg, *args, **kwargs):
|
def verbose(self, msg, *args, **kwargs):
|
||||||
return self.log(logging.INFO - 1, msg, *args, **kwargs)
|
return self.log(logging.INFO - 1, msg, *args, **kwargs)
|
||||||
|
|
||||||
def exception(self, msg, *args, **kwargs):
|
|
||||||
return self.critical("%s\n%s" % (msg, traceback.format_exc()), *args, **kwargs)
|
|
||||||
|
|
||||||
logging.raiseExceptions = False
|
logging.raiseExceptions = False
|
||||||
logging.setLoggerClass(BBLogger)
|
logging.setLoggerClass(BBLogger)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user