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

[tor-commits] [bridgedb/develop] Fix logging format



commit 769712e03d37a294ba6a5b15ba0ddcbbfe3465d3
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sun Jan 19 15:15:33 2020 -0800

    Fix logging format
    
    BridgeDB tried to configure its logging format via a private attribute. That
    attribute no longer works in python 3. Configuring the formatter via its
    constructor instead. This fixes...
    
      Traceback (most recent call last):
        File "/home/atagar/Desktop/tor/bridgedb/bridgedb/test/test_util.py", line 174, in test_util_JustifiedLogFormatter_format
          self.assertTrue('INFO' in formatted)
        File "/usr/local/lib/python3.5/dist-packages/twisted/trial/_synctest.py", line 395, in assertTrue
          super(_Assertions, self).assertTrue(condition, msg)
        File "/usr/lib/python3.5/unittest/case.py", line 677, in assertTrue
          raise self.failureException(msg)
      twisted.trial.unittest.FailTest: False is not true
    
    Test results changed as follows...
    
      before: FAILED (skips=115, failures=27, successes=842)
      after:  FAILED (skips=115, failures=26, successes=843)
---
 bridgedb/util.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/bridgedb/util.py b/bridgedb/util.py
index db8e749..9572ad1 100644
--- a/bridgedb/util.py
+++ b/bridgedb/util.py
@@ -307,7 +307,6 @@ class JustifiedLogFormatter(logging.Formatter):
         :param bool logTrace: If ``True``, include information on the calling
             function in formatted log messages.
         """
-        super(JustifiedLogFormatter, self).__init__(datefmt=datefmt)
         self.logThreads = logThreads
         self.logTrace = logTrace
 
@@ -317,7 +316,7 @@ class JustifiedLogFormatter(logging.Formatter):
         _fmt.append("%(callingFunc)s")
         _fmt.append("%(message)s")
 
-        self._fmt = " ".join(_fmt)
+        super(JustifiedLogFormatter, self).__init__(fmt = " ".join(_fmt), datefmt=datefmt)
 
     def _formatCallingFuncName(self, record):
         """Format the combined module name and function name of the place where



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