mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
added StackTrace().compact()
This commit is contained in:
parent
e438f27d76
commit
5797b16416
@ -124,6 +124,15 @@ class StackTrace:
|
|||||||
else:
|
else:
|
||||||
self.trace = traceback.extract_stack(sys._getframe(1+start))
|
self.trace = traceback.extract_stack(sys._getframe(1+start))
|
||||||
|
|
||||||
|
def compact(self):
|
||||||
|
r = ''
|
||||||
|
comma = ','
|
||||||
|
for filename, lineNum, funcName, text in self.trace:
|
||||||
|
r += '%s.%s:%s%s' % (filename[filename.rfind('\\')+1:], funcName, lineNum, comma)
|
||||||
|
if len(r):
|
||||||
|
r = r[:-len(comma)]
|
||||||
|
return r
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
r = "Debug stack trace of %s (back %s frames):\n"%(
|
r = "Debug stack trace of %s (back %s frames):\n"%(
|
||||||
self.label, len(self.trace),)
|
self.label, len(self.trace),)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user