diff orpg/tools/orpg_log.py @ 123:174658f839c0 alpha

Traipse Alpha 'OpenRPG' {091001-00} 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 (Cleaning up for 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 (Completed, see documentation for usage) Mercurial's hgweb folder is ported to upmana Happy Halloween!
author sirebral
date Sun, 01 Nov 2009 01:12:50 -0600
parents 36919b8a3ef9
children 8827271fbe1b
line wrap: on
line diff
--- a/orpg/tools/orpg_log.py	Sat Oct 31 22:07:55 2009 -0500
+++ b/orpg/tools/orpg_log.py	Sun Nov 01 01:12:50 2009 -0600
@@ -69,18 +69,27 @@
     """A simple debugger. Add debug() to a function and it prints the function name and any objects included. 
     Adding True to locale prints the file name where the function is. Adding False to log turns the log off.
     This feature can be modified to trace deeper and find the bugs faster, ending the puzzle box."""
-    def __init__(self, objects=None, locale=False, log=True):
+    def __init__(self, objects=None, locale=False, log=True, parents=False):
         if log == False: return
         current = inspect.currentframe()
-        self.true_debug(current, objects)
+        if parents: self.get_parents(current)
+        self.true_debug(current, objects, locale)
 
-    def true_debug(self, current, objects):
-        if objects != None:
-            if locale == True: print inspect.getouterframes(current)[1][3], objects, inspect.getouterframes(current)[1][1]
-            else: print inspect.getouterframes(current)[1][3], objects
-        else:
-            if locale == True: print inspect.getouterframes(current)[1][3], inspect.getouterframes(current)[1][1]
-            else: print inspect.getouterframes(current)[1][3]
+    def true_debug(self, current, objects, locale):
+        debug_string = 'Function: ' + str(inspect.getouterframes(current)[1][3])
+        #if locale == 'all': print inspect.getouterframes(current)[4]; return
+        if objects != None: debug_string += ' Objects: ' + str(objects)
+        if locale: debug_string += ' File: ' + str(inspect.getouterframes(current)[1][1])
+        print debug_string
+        return
+
+    def get_parents(self, current):
+        debug_string = 'Function: ' + str(inspect.getouterframes(current)[1][3]) + ' Parents:'
+        family = list(inspect.getouterframes(current))
+        for parent in family:
+            debug_string += ' ' + str(parent[4])
+        print debug_string
+        return
     
 class DebugConsole(wx.Frame):
     def __init__(self, parent):
@@ -103,7 +112,7 @@
         self.Bind(wx.EVT_BUTTON, self.clear, self.bt_clear)
         self.Bind(wx.EVT_BUTTON, self.bug_report, self.report)
         self.Min(None)
-        sys.stdout = Term2Win()
+        #sys.stdout = Term2Win()
         component.add('debugger', self.console)
 
     def Min(self, evt):