(self, pyfile)
| 88 | self.m.core.log.info("Debug Report written to %s" % dump_name) |
| 89 | |
| 90 | def getDebugDump(self, pyfile): |
| 91 | dump = "pyLoad %s Debug Report of %s %s \n\nTRACEBACK:\n %s \n\nFRAMESTACK:\n" % ( |
| 92 | self.m.core.api.getServerVersion(), pyfile.pluginname, pyfile.plugin.__version__, format_exc()) |
| 93 | |
| 94 | tb = exc_info()[2] |
| 95 | stack = [] |
| 96 | while tb: |
| 97 | stack.append(tb.tb_frame) |
| 98 | tb = tb.tb_next |
| 99 | |
| 100 | for frame in stack[1:]: |
| 101 | dump += "\nFrame %s in %s at line %s\n" % (frame.f_code.co_name, |
| 102 | frame.f_code.co_filename, |
| 103 | frame.f_lineno) |
| 104 | |
| 105 | for key, value in frame.f_locals.items(): |
| 106 | dump += "\t%20s = " % key |
| 107 | try: |
| 108 | dump += pformat(value) + "\n" |
| 109 | except Exception, e: |
| 110 | dump += "<ERROR WHILE PRINTING VALUE> " + str(e) + "\n" |
| 111 | |
| 112 | del frame |
| 113 | |
| 114 | del stack #delete it just to be sure... |
| 115 | |
| 116 | dump += "\n\nPLUGIN OBJECT DUMP: \n\n" |
| 117 | |
| 118 | for name in dir(pyfile.plugin): |
| 119 | attr = getattr(pyfile.plugin, name) |
| 120 | if not name.endswith("__") and type(attr) != MethodType: |
| 121 | dump += "\t%20s = " % name |
| 122 | try: |
| 123 | dump += pformat(attr) + "\n" |
| 124 | except Exception, e: |
| 125 | dump += "<ERROR WHILE PRINTING VALUE> " + str(e) + "\n" |
| 126 | |
| 127 | dump += "\nPYFILE OBJECT DUMP: \n\n" |
| 128 | |
| 129 | for name in dir(pyfile): |
| 130 | attr = getattr(pyfile, name) |
| 131 | if not name.endswith("__") and type(attr) != MethodType: |
| 132 | dump += "\t%20s = " % name |
| 133 | try: |
| 134 | dump += pformat(attr) + "\n" |
| 135 | except Exception, e: |
| 136 | dump += "<ERROR WHILE PRINTING VALUE> " + str(e) + "\n" |
| 137 | |
| 138 | if pyfile.pluginname in self.m.core.config.plugin: |
| 139 | dump += "\n\nCONFIG: \n\n" |
| 140 | dump += pformat(self.m.core.config.plugin[pyfile.pluginname]) + "\n" |
| 141 | |
| 142 | return dump |
| 143 | |
| 144 | def clean(self, pyfile): |
| 145 | """ set thread unactive and release pyfile """ |
no test coverage detected