gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leosim...@apache.org
Subject svn commit: r161664 - gump/branches/Gump3/pygump/python/gump/plugins/logreporter.py
Date Sun, 17 Apr 2005 15:49:19 GMT
Author: leosimons
Date: Sun Apr 17 08:49:19 2005
New Revision: 161664

URL: http://svn.apache.org/viewcvs?view=rev&rev=161664
Log:
Log exceptions.

* pygump/python/gump/plugins/logreporter.py: in addition to outputting log messages, make
the log reporter output stack traces for all exceptions that were swallowed during the run.

Modified:
    gump/branches/Gump3/pygump/python/gump/plugins/logreporter.py

Modified: gump/branches/Gump3/pygump/python/gump/plugins/logreporter.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/plugins/logreporter.py?view=diff&r1=161663&r2=161664
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/plugins/logreporter.py (original)
+++ gump/branches/Gump3/pygump/python/gump/plugins/logreporter.py Sun Apr 17 08:49:19 2005
@@ -32,15 +32,26 @@
         self.log.debug(hr)
 
     def _do_visit(self, object, container=None):
+        name = getattr(object, "name", "unnamed %s" % type(object))
+        if container:
+            if hasattr(container, "name"):
+                name = "%s:%s" % (container.name, name)
+
         for attribute in dir(object):
             if attribute.endswith("_log"):
                 logmsg = getattr(object,attribute)
-                name = getattr(object, "name", "unnamed %s" % type(object))
-                if container:
-                    if hasattr(container, "name"):
-                        name = "%s:%s" % (container.name, name)
                 self.log.debug("---%s.%s----------------------------------:\n%s" % (name,
attribute, logmsg))
                 self.log.debug(hr)
+
+        if hasattr(object, 'exceptions'):
+            import StringIO
+            import traceback
+            for entry in object.exceptions:
+                target = StringIO.StringIO()
+                traceback.print_tb(entry[2], file=target)
+                trace = target.getvalue()
+                target.close()
+                self.log.error("---%s--exception--%s:%s------:\n%s" % (name, entry[0], entry[1],
trace))
     
     def visit_workspace(self, workspace):
         self._do_visit(workspace)



Mime
View raw message