Move logging utilities out of the side drawer of util/ and into logging/ (#5606)

This commit is contained in:
Amber Brown 2019-07-04 00:07:04 +10:00 committed by GitHub
parent cb8d568cf9
commit 463b072b12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
98 changed files with 249 additions and 233 deletions

View file

@ -19,7 +19,8 @@ from six.moves import range
from twisted.internet import defer, reactor
from twisted.internet.defer import CancelledError
from synapse.util import Clock, logcontext
from synapse.logging.context import LoggingContext
from synapse.util import Clock
from synapse.util.async_helpers import Linearizer
from tests import unittest
@ -51,13 +52,13 @@ class LinearizerTestCase(unittest.TestCase):
@defer.inlineCallbacks
def func(i, sleep=False):
with logcontext.LoggingContext("func(%s)" % i) as lc:
with LoggingContext("func(%s)" % i) as lc:
with (yield linearizer.queue("")):
self.assertEqual(logcontext.LoggingContext.current_context(), lc)
self.assertEqual(LoggingContext.current_context(), lc)
if sleep:
yield Clock(reactor).sleep(0)
self.assertEqual(logcontext.LoggingContext.current_context(), lc)
self.assertEqual(LoggingContext.current_context(), lc)
func(0, sleep=True)
for i in range(1, 100):