comparison orpg/tools/orpg_log.py @ 142:2345c12d93a7 beta

Traipse Beta 'OpenRPG' {091123-01} Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc's main goal is to offer more advanced features and enhance the productivity of the user. Update Summary (Beta) Added Bookmarks Fix to Remote Admin Commands Minor fix to text based Server Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Added 'boot' command to remote admin Added confirmation window for sent nodes Minor changes to allow for portability to an OpenSUSE linux OS Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Zoom Mouse plugin added Images added to Plugin UI Switching to Element Tree Map efficiency, from FlexiRPG Added Status Bar to Update Manager default_manifest.xml renamed to default_upmana.xml Cleaner clode for saved repositories New TrueDebug Class in orpg_log (See documentation for usage) Mercurial's hgweb folder is ported to upmana Pretty important update that can help remove thousands of dead children from your gametree. Children, <forms />, <group_atts />, <horizontal />, <cols />, <rows />, <height />, etc... are all tags now. Check your gametree and look for dead children!! New Gametree Recursion method, mapping, and context sensitivity. !Infinite Loops return error instead of freezing the software! New Syntax added for custom PC sheets Tip of the Day added, from Core and community Fixed Whiteboard ID to prevent random line or text deleting. Modified ID's to prevent non updated clients from ruining the fix.
author sirebral
date Mon, 23 Nov 2009 12:20:51 -0600
parents dcf4fbe09b70
children dcae32e219f1
comparison
equal deleted inserted replaced
140:e842a5f1b775 142:2345c12d93a7
56 crash_report.close() 56 crash_report.close()
57 logger.exception("Crash Report Created!!") 57 logger.exception("Crash Report Created!!")
58 logger.info("Printed out crash-report.txt in your System folder", True) 58 logger.info("Printed out crash-report.txt in your System folder", True)
59 59
60 class Term2Win(object): 60 class Term2Win(object):
61 # A stdout redirector. Allows the messages from Mercurial to be seen in the Install Window 61 # A stdout redirector. To be implemented later.
62 def write(self, text): 62 def write(self, text):
63 #logger.stdout(text) 63 logger.stdout(text)
64 wx.Yield() 64 wx.Yield()
65 sys.__stdout__.write(text) 65 #sys.__stdout__.write(text)
66 66
67 class TrueDebug(object): 67 class TrueDebug(object):
68 ### Alpha ###
69 """A simple debugger. Add debug() to a function and it prints the function name and any objects included. Add an object or a group of objects in ()'s. 68 """A simple debugger. Add debug() to a function and it prints the function name and any objects included. Add an object or a group of objects in ()'s.
70 Adding True to locale prints the file name where the function is. Adding False to log turns the log off. 69 Adding True to locale prints the file name where the function is. Adding False to log turns the log off.
71 Adding True to parents will print out the parent functions, starting from TrueDebug. 70 Adding True to parents will print out the parent functions, starting from TrueDebug.
72 This feature can be modified to trace deeper and find the bugs faster, ending the puzzle box.""" 71 This feature can be modified to trace deeper and find the bugs faster, ending the puzzle box."""
73 def __init__(self, objects=None, locale=False, log=True, parents=False): 72 def __init__(self, objects=None, locale=False, log=True, parents=False):
94 93
95 class DebugConsole(wx.Frame): 94 class DebugConsole(wx.Frame):
96 def __init__(self, parent): 95 def __init__(self, parent):
97 super(DebugConsole, self).__init__(parent, -1, "Debug Console") 96 super(DebugConsole, self).__init__(parent, -1, "Debug Console")
98 icon = wx.Icon(dir_struct["icon"]+'note.ico', wx.BITMAP_TYPE_ICO) 97 icon = wx.Icon(dir_struct["icon"]+'note.ico', wx.BITMAP_TYPE_ICO)
98 self.parent = parent
99 self.SetIcon(icon) 99 self.SetIcon(icon)
100 self.console = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE | wx.TE_READONLY) 100 self.console = wx.TextCtrl(self, -1, style=wx.TE_MULTILINE | wx.TE_READONLY)
101 self.bt_clear = wx.Button(self, wx.ID_CLEAR) 101 self.bt_clear = wx.Button(self, wx.ID_CLEAR)
102 self.report = wx.Button(self, wx.ID_ANY, 'Bug Report') 102 self.report = wx.Button(self, wx.ID_ANY, 'Bug Report')
103 sizer = wx.GridBagSizer(hgap=1, vgap=1) 103 sizer = wx.GridBagSizer(hgap=1, vgap=1)
121 121
122 def clear(self, evt): 122 def clear(self, evt):
123 self.console.SetValue('') 123 self.console.SetValue('')
124 124
125 def bug_report(self, evt): 125 def bug_report(self, evt):
126 pass 126 self.parent.OnMB_HelpReportaBug()
127 127
128 class orpgLog(object): 128 class orpgLog(object):
129 _log_level = 7 129 _log_level = 7
130 _log_name = None 130 _log_name = None
131 _log_to_console = False 131 _log_to_console = False
148 'log_string': 'INFO'}, 148 'log_string': 'INFO'},
149 2: {'colorizer': {'red': True}, 149 2: {'colorizer': {'red': True},
150 'log_string': 'ERROR'}, 150 'log_string': 'ERROR'},
151 1: {'colorizer': {'bold': True, 'red': True}, 151 1: {'colorizer': {'bold': True, 'red': True},
152 'log_string': 'EXCEPTION'}} 152 'log_string': 'EXCEPTION'}}
153
153 if not self.log_name: 154 if not self.log_name:
154 self.log_name = home_dir + filename + time.strftime('%m-%d-%Y.txt', 155 self.log_name = home_dir + filename + time.strftime('%m-%d-%Y.txt',
155 time.localtime(time.time())) 156 time.localtime(time.time()))
156 157
157 def debug(self, msg, to_console=False): 158 def debug(self, msg, to_console=False):
164 self.log(msg, ORPG_INFO, to_console) 165 self.log(msg, ORPG_INFO, to_console)
165 166
166 def general(self, msg, to_console=False): 167 def general(self, msg, to_console=False):
167 self.log(msg, ORPG_GENERAL, to_console) 168 self.log(msg, ORPG_GENERAL, to_console)
168 169
170 def stdout(self, msg, to_console=True):
171 self.log(msg, ORPG_INFO, to_console)
172
169 def exception(self, msg, to_console=True): 173 def exception(self, msg, to_console=True):
170 ### Beta ### Every 'Critical' exception will draw attention to the Debug Console
171 component.get('frame').TraipseSuiteWarn('debug') 174 component.get('frame').TraipseSuiteWarn('debug')
172 self.log(msg, ORPG_CRITICAL, to_console) 175 self.log(msg, ORPG_CRITICAL, to_console)
173 176
174 def log(self, msg, log_type, to_console=False): 177 def log(self, msg, log_type, to_console=False):
175 if self.log_to_console or to_console or log_type == ORPG_CRITICAL: 178 if self.log_to_console or to_console or log_type == ORPG_CRITICAL: