Mercurial > traipse_dev
comparison orpg/tools/orpg_log.py @ 82:2fa8bd6785a5 ornery-dev
TerminalWriter's colors are nice, but if no debug console is open it causes the software to look for one until a recursion error is created. Crash reports are sent to the debug console and a pop-up tells the user one has happened. Fix to chat window from SnowDog.
author | sirebral |
---|---|
date | Thu, 27 Aug 2009 00:51:22 -0500 |
parents | 65c212e9a5b4 |
children | bdbeafcb2ef4 |
comparison
equal
deleted
inserted
replaced
81:65c212e9a5b4 | 82:2fa8bd6785a5 |
---|---|
52 for line in crash_report: msg += line | 52 for line in crash_report: msg += line |
53 logger.exception(msg) | 53 logger.exception(msg) |
54 crash_report.close() | 54 crash_report.close() |
55 logger.exception("Crash Report Created!!") | 55 logger.exception("Crash Report Created!!") |
56 logger.info("Printed out crash-report.txt in your System folder", True) | 56 logger.info("Printed out crash-report.txt in your System folder", True) |
57 if sys.platform in ('win32', 'win64'): | 57 wx.MessageBox('Crash Report Created!', 'System Failure') |
58 logger.info("Press <enter> to continue!", True) | |
59 raw_input('') | |
60 #exit() | |
61 | 58 |
62 class DebugConsole(wx.Frame): | 59 class DebugConsole(wx.Frame): |
63 def __init__(self, parent): | 60 def __init__(self, parent): |
64 super(DebugConsole, self).__init__(parent, -1, "Debug Window") | 61 super(DebugConsole, self).__init__(parent, -1, "Debug Window") |
65 icon = None | 62 icon = None |
122 def exception(self, msg, to_console=True): | 119 def exception(self, msg, to_console=True): |
123 self.log(msg, ORPG_CRITICAL, to_console) | 120 self.log(msg, ORPG_CRITICAL, to_console) |
124 | 121 |
125 def log(self, msg, log_type, to_console=False): | 122 def log(self, msg, log_type, to_console=False): |
126 if self.log_to_console or to_console or log_type == ORPG_CRITICAL: | 123 if self.log_to_console or to_console or log_type == ORPG_CRITICAL: |
127 self._io.line(str(msg), **self._lvl_args[log_type]['colorizer']) | 124 try: self._io.line(str(msg), **self._lvl_args[log_type]['colorizer']) |
125 except: pass #Fails without the Debug Console | |
128 try: component.get('debugger').AppendText(".. " + str(msg) +'\n') | 126 try: component.get('debugger').AppendText(".. " + str(msg) +'\n') |
129 except: pass | 127 except: pass |
130 | 128 |
131 if log_type & self.log_level or to_console: | 129 if log_type & self.log_level or to_console: |
132 atr = {'msg': msg, 'level': self._lvl_args[log_type]['log_string']} | 130 atr = {'msg': msg, 'level': self._lvl_args[log_type]['log_string']} |