Unverified Commit 769712e0 authored by Damian Johnson's avatar Damian Johnson Committed by Philipp Winter
Browse files

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)
parent 6df6f367
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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