diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2019-07-04 00:07:04 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-04 00:07:04 +1000 |
commit | 463b072b1290a8cb75bc1d7b6688fa76bbfdb14f (patch) | |
tree | b3b3f1807e74ff1aa23f48384c4d64a165975131 /synapse/util/__init__.py | |
parent | Fix 'utime went backwards' errors on daemonization. (#5609) (diff) | |
download | synapse-463b072b1290a8cb75bc1d7b6688fa76bbfdb14f.tar.xz |
Move logging utilities out of the side drawer of util/ and into logging/ (#5606)
Diffstat (limited to 'synapse/util/__init__.py')
-rw-r--r-- | synapse/util/__init__.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/synapse/util/__init__.py b/synapse/util/__init__.py index 954e32fb2a..c6d2ce4404 100644 --- a/synapse/util/__init__.py +++ b/synapse/util/__init__.py @@ -21,10 +21,14 @@ import attr from twisted.internet import defer, task -from synapse.util.logcontext import PreserveLoggingContext +from synapse.logging import context, formatter logger = logging.getLogger(__name__) +# Compatibility alias, for existing logconfigs. +logcontext = context +logformatter = formatter + def unwrapFirstError(failure): # defer.gatherResults and DeferredLists wrap failures. @@ -46,7 +50,7 @@ class Clock(object): @defer.inlineCallbacks def sleep(self, seconds): d = defer.Deferred() - with PreserveLoggingContext(): + with context.PreserveLoggingContext(): self._reactor.callLater(seconds, d.callback, seconds) res = yield d defer.returnValue(res) @@ -91,10 +95,10 @@ class Clock(object): """ def wrapped_callback(*args, **kwargs): - with PreserveLoggingContext(): + with context.PreserveLoggingContext(): callback(*args, **kwargs) - with PreserveLoggingContext(): + with context.PreserveLoggingContext(): return self._reactor.callLater(delay, wrapped_callback, *args, **kwargs) def cancel_call_later(self, timer, ignore_errs=False): |