Override format to add thread information.
(self, record)
| 33 | self._last_log_thread = None |
| 34 | |
| 35 | def format(self, record): |
| 36 | """Override format to add thread information.""" |
| 37 | |
| 38 | #super() doesn't work in py2.6 as 'logging' uses old-style class |
| 39 | log_str = logging.Formatter.format(self, record) |
| 40 | # If msg comes from a different thread than our last, prepend |
| 41 | # thread info. Most look like 'Account sync foo' or 'Folder |
| 42 | # sync foo'. |
| 43 | t_name = record.threadName |
| 44 | if t_name == 'MainThread': |
| 45 | return log_str # main thread doesn't get things prepended |
| 46 | if t_name != self._last_log_thread: |
| 47 | self._last_log_thread = t_name |
| 48 | log_str = "%s:\n %s" % (t_name, log_str) |
| 49 | else: |
| 50 | log_str = " %s"% log_str |
| 51 | return log_str |
| 52 | |
| 53 | |
| 54 | class TTYUI(UIBase): |
no outgoing calls