summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-08-13 19:23:49 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-08-13 19:23:49 +0200
commit27da5c2b72c883ee9fcd5e1bb80f0eece76290ed (patch)
treeafa017db64e778a16e6dfbf6a48dc32e913d9dcc
parentadded simple update manager (diff)
downloadpyload-27da5c2b72c883ee9fcd5e1bb80f0eece76290ed.tar.xz
detailed debug reports
-rw-r--r--module/PluginThread.py35
1 files changed, 34 insertions, 1 deletions
diff --git a/module/PluginThread.py b/module/PluginThread.py
index f727aa7f0..22ff9b9c9 100644
--- a/module/PluginThread.py
+++ b/module/PluginThread.py
@@ -21,7 +21,9 @@
from Queue import Queue
from threading import Thread
from time import sleep
-from traceback import print_exc
+from traceback import print_exc, format_exc
+from pprint import pformat
+from sys import exc_info
from module.plugins.Plugin import Abort
from module.plugins.Plugin import Fail
@@ -140,6 +142,37 @@ class DownloadThread(PluginThread):
if self.m.core.debug:
print_exc()
+
+ dump = "pyLoad Debug Report\n\nTRACEBACK from %s:\n %s \n\nDUMP from %s:\n" % (pyfile.pluginname, format_exc(), pyfile.pluginname)
+
+ tb = exc_info()[2]
+ stack = []
+ while tb:
+ stack.append(tb.tb_frame)
+ tb = tb.tb_next
+
+ for frame in stack[1:]:
+
+ dump += "\nFrame %s in %s at line %s\n" % (frame.f_code.co_name,
+ frame.f_code.co_filename,
+ frame.f_lineno)
+
+ for key, value in frame.f_locals.items():
+ dump += "\t%20s = " % key
+ try:
+ dump += pformat(value) + "\n"
+ except:
+ dump += "<ERROR WHILE PRINTING VALUE>\n"
+
+ if hasattr(pyfile.plugin, "html"):
+ dump += "HTML DUMP:\n\n %s" % pyfile.plugin.html
+
+
+ dump_name = "debug_%s.txt" % pyfile.pluginname
+ self.m.core.log.info("Debug Report written to %s" % dump_name)
+ f = open(dump_name, "wb")
+ f.write(dump)
+ f.close()
self.active = False
pyfile.release()