diff options
author | Chris Larson <chris_larson@mentor.com> | 2011-05-05 17:43:38 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-06-08 20:38:25 +0100 |
commit | 96e2ee1d730fa19665cca34c2cc3deb3fa5dfd2d (patch) | |
tree | 9c75b5c023be0bb02681d09cf42b1d4f358364c4 /bitbake/lib/bb/msg.py | |
parent | a3efbb96f23a222c58f2f4114a75d2f98d7da11f (diff) | |
download | poky-96e2ee1d730fa19665cca34c2cc3deb3fa5dfd2d.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.
(Bitbake rev: ee48d628ee038bd72e1cd94aa75f5ccbacbcee4c)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/msg.py')
-rw-r--r-- | bitbake/lib/bb/msg.py | 10 |
1 files changed, 8 insertions, 2 deletions
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): | |||
65 | def format(self, record): | 65 | def format(self, record): |
66 | record.levelname = self.getLevelName(record.levelno) | 66 | record.levelname = self.getLevelName(record.levelno) |
67 | if record.levelno == self.PLAIN: | 67 | if record.levelno == self.PLAIN: |
68 | return record.getMessage() | 68 | msg = record.getMessage() |
69 | else: | 69 | else: |
70 | return logging.Formatter.format(self, record) | 70 | msg = logging.Formatter.format(self, record) |
71 | |||
72 | if hasattr(record, 'bb_exc_info'): | ||
73 | etype, value, tb = record.bb_exc_info | ||
74 | formatted = bb.exceptions.format_exception(etype, value, tb, limit=5) | ||
75 | msg += '\n' + ''.join(formatted) | ||
76 | return msg | ||
71 | 77 | ||
72 | class Loggers(dict): | 78 | class Loggers(dict): |
73 | def __getitem__(self, key): | 79 | def __getitem__(self, key): |