[tor-commits] [arm/master] Fixing debug output

atagar at torproject.org atagar at torproject.org
Thu Jan 3 03:06:21 UTC 2013


commit 6a32878e068862761aa2f451631a78e4eccd427f
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Jan 2 19:04:27 2013 -0800

    Fixing debug output
    
    Refactoring changes had broken our '--debug' argument. Not only is it now fixed
    but it's even better in that we now have trace level logging output.
---
 src/starter.py |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/starter.py b/src/starter.py
index db68a6d..498ba99 100644
--- a/src/starter.py
+++ b/src/starter.py
@@ -12,6 +12,7 @@ import time
 import getopt
 import getpass
 import locale
+import logging
 import platform
 
 import version
@@ -308,8 +309,15 @@ if __name__ == '__main__':
   if isDebugMode:
     try:
       stem_logger = stem.util.log.get_logger()
-      stem_logger.addHandler(logging.FileHandler(LOG_DUMP_PATH))
-      stem_logger.setLevel(stem.util.log.logging_level(stem.util.log.TRACE))
+      
+      debugHandler = logging.FileHandler(LOG_DUMP_PATH)
+      debugHandler.setLevel(stem.util.log.logging_level(stem.util.log.TRACE))
+      debugHandler.setFormatter(logging.Formatter(
+        fmt = '%(asctime)s [%(levelname)s] %(message)s',
+        datefmt = '%m/%d/%Y %H:%M:%S'
+      ))
+      
+      stem_logger.addHandler(debugHandler)
       
       currentTime = time.localtime()
       timeLabel = time.strftime("%H:%M:%S %m/%d/%Y (%Z)", currentTime)



More information about the tor-commits mailing list