From 96e2ee1d730fa19665cca34c2cc3deb3fa5dfd2d Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Thu, 5 May 2011 17:43:38 -0700 Subject: Shift exception formatting into the UI Now we use bb.exceptions to pass pickleable traceback entries to the UI, and the UI is free to do whatever it wants to do with this information. By default, the log formatter for the UIs formats it with bb.exceptions. This also means that all exceptions should now show 3 lines of context and limit to 5 entries. (Bitbake rev: ee48d628ee038bd72e1cd94aa75f5ccbacbcee4c) Signed-off-by: Chris Larson Signed-off-by: Richard Purdie --- bitbake/lib/bb/msg.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'bitbake/lib/bb/msg.py') diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py index a7ac850790..12d19ff8e1 100644 --- a/bitbake/lib/bb/msg.py +++ b/bitbake/lib/bb/msg.py @@ -65,9 +65,15 @@ class BBLogFormatter(logging.Formatter): def format(self, record): record.levelname = self.getLevelName(record.levelno) if record.levelno == self.PLAIN: - return record.getMessage() + msg = record.getMessage() else: - return logging.Formatter.format(self, record) + msg = logging.Formatter.format(self, record) + + if hasattr(record, 'bb_exc_info'): + etype, value, tb = record.bb_exc_info + formatted = bb.exceptions.format_exception(etype, value, tb, limit=5) + msg += '\n' + ''.join(formatted) + return msg class Loggers(dict): def __getitem__(self, key): -- cgit v1.2.3-54-g00ecf