summaryrefslogtreecommitdiffstats
path: root/lib/bb/msg.py
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2011-05-05 17:43:38 -0700
committerChris Larson <chris_larson@mentor.com>2011-05-16 12:39:42 -0700
commitee48d628ee038bd72e1cd94aa75f5ccbacbcee4c (patch)
treeb7eeea9d13b7cbe51d1a7a8aa44b1e3d2f0a9df8 /lib/bb/msg.py
parentcae6bf031dc83ba0439d07584fdbbd4a962408a3 (diff)
downloadbitbake-ee48d628ee038bd72e1cd94aa75f5ccbacbcee4c.tar.gz
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. Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'lib/bb/msg.py')
-rw-r--r--lib/bb/msg.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/bb/msg.py b/lib/bb/msg.py
index a7ac85079..12d19ff8e 100644
--- a/lib/bb/msg.py
+++ b/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):