[tor-commits] [stem/master] Accounting for logging.Handler bug in python 2.5

atagar at torproject.org atagar at torproject.org
Sun Jul 8 03:08:48 UTC 2012


commit bbcff94dee48e96db3e7c9b396926a9fac7f64b9
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Jul 7 20:07:18 2012 -0700

    Accounting for logging.Handler bug in python 2.5
    
    In python 2.5 logging.Handler doesn't extend object, causing our super() call
    to fail with a stacktrace. Hacking around it.
---
 stem/util/log.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/stem/util/log.py b/stem/util/log.py
index 38815ba..0cd89e7 100644
--- a/stem/util/log.py
+++ b/stem/util/log.py
@@ -152,7 +152,13 @@ class LogBuffer(logging.Handler):
   """
   
   def __init__(self, runlevel):
-    super(LogBuffer, self).__init__(level = logging_level(runlevel))
+    # TODO: At least in python 2.5 logging.Handler has a bug in that it doesn't
+    # extend object, causing our super() call to fail. When we drop python 2.5
+    # support we should switch back to using super() instead.
+    #super(LogBuffer, self).__init__(level = logging_level(runlevel))
+    
+    logging.Handler.__init__(self, level = logging_level(runlevel))
+    
     self.formatter = logging.Formatter(
       fmt = '%(asctime)s [%(levelname)s] %(message)s',
       datefmt = '%D %H:%M:%S')



More information about the tor-commits mailing list