[tor-commits] [stem/master] Replacing platform specific %D date formatting

atagar at torproject.org atagar at torproject.org
Sun Jul 8 03:47:44 UTC 2012


commit a325a40ff04df1a83614c529995749f2da8e79f8
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Jul 7 20:42:45 2012 -0700

    Replacing platform specific %D date formatting
    
    Python's strftime() method has a set of platform independent flags, but also
    accepts anything that our platform's libc does...
    http://stackoverflow.com/questions/10807164/python-time-formatting-different-in-windows
    
    I was using '%D' date formatting for our logging, but that doesn't work on
    Windows...
    https://trac.torproject.org/6206
    
    Replacing with the equivilant platform independent flags. Issue caught by Beck.
---
 stem/util/log.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/stem/util/log.py b/stem/util/log.py
index 0cd89e7..9caa462 100644
--- a/stem/util/log.py
+++ b/stem/util/log.py
@@ -161,7 +161,7 @@ class LogBuffer(logging.Handler):
     
     self.formatter = logging.Formatter(
       fmt = '%(asctime)s [%(levelname)s] %(message)s',
-      datefmt = '%D %H:%M:%S')
+      datefmt = '%m/%d/%Y %H:%M:%S')
     
     self._buffer = []
   
@@ -185,6 +185,6 @@ def log_to_stdout(runlevel):
   logging.basicConfig(
     level = logging_level(runlevel),
     format = '%(asctime)s [%(levelname)s] %(message)s',
-    datefmt = '%D %H:%M:%S',
+    datefmt = '%m/%d/%Y %H:%M:%S',
   )
 



More information about the tor-commits mailing list