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

art at torproject.org art at torproject.org
Mon Nov 12 19:14:03 UTC 2012


commit fbbb11f9f5bc2e8c2056e775e92d42096bfa5d9d
Author: Arturo Filastò <art at fuffa.org>
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)
 





More information about the tor-commits mailing list