[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] Add exception logging method



commit fbbb11f9f5bc2e8c2056e775e92d42096bfa5d9d
Author: Arturo Filastò <art@xxxxxxxxx>
Date:   Mon Nov 12 09:37:59 2012 +0100

    Add exception logging method
---
 ooni/utils/log.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/ooni/utils/log.py b/ooni/utils/log.py
index 743161f..6f4622d 100644
--- a/ooni/utils/log.py
+++ b/ooni/utils/log.py
@@ -5,6 +5,7 @@
 
 import sys
 import os
+import traceback
 import logging
 
 from twisted.python import log as txlog
@@ -50,6 +51,11 @@ def debug(msg, *arg, **kw):
 def err(msg, *arg, **kw):
     txlog.err("Error: " + str(msg), logLevel=logging.ERROR, *arg, **kw)
 
+def exception(msg):
+    txlog.err(msg)
+    exc_type, exc_value, exc_traceback = sys.exc_info()
+    traceback.print_exception(exc_type, exc_value, exc_traceback)
+
 def exception(*msg):
     logging.exception(msg)
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits