commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue/gnue-common/gnue/common GDebug.py


From: Jason Cater
Subject: gnue/gnue-common/gnue/common GDebug.py
Date: Mon, 14 May 2001 12:58:42 -0700

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    01/05/14 12:58:42

Modified files:
        gnue-common/gnue/common: GDebug.py 

Log message:
        Updated GDebug.printMesg to print filename:line number next to messages 
(.e.g, DB001 [GFObjects:15] Debug Message)

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/gnue/common/GDebug.py.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: gnue/gnue-common/gnue/common/GDebug.py
diff -u gnue/gnue-common/gnue/common/GDebug.py:1.2 
gnue/gnue-common/gnue/common/GDebug.py:1.3
--- gnue/gnue-common/gnue/common/GDebug.py:1.2  Fri May 11 11:56:35 2001
+++ gnue/gnue-common/gnue/common/GDebug.py      Mon May 14 12:58:42 2001
@@ -31,7 +31,7 @@
 
 import string
 import sys
-from traceback import format_exception
+from traceback import *
 
 _fh = sys.__stderr__
 _conttest = 0
@@ -86,9 +86,19 @@
 def printMesg(level, message):
     global _fh
     if ( int(level) <= int(_DEBUG_LEVEL) ):
-        lines = string.split(message, '\n')
-        for line in lines:
-            _fh.write("DB%03d: %s\n"%(level, line))
+      caller = extract_stack()[-2]
+      try: 
+        if caller[0][-3:] == '.py': 
+          file = "[%s:%s] " % (string.split(caller[0][:-3],'/')[-1], caller[1])
+        else: 
+          file = "[%s:%s] " % (string.split(caller[0],'/')[-1], caller[1])
+      except: 
+        file = ""
+
+      lines = string.split(message, '\n')
+      for line in lines:
+         _fh.write("DB%03d: %s%s\n" % (level, file, line))
+
 
 class GETrace(Exception):
     #



reply via email to

[Prev in Thread] Current Thread [Next in Thread]