summary refs log tree commit diff
diff options
context:
space:
mode:
authorEric Eastwood <erice@element.io>2022-08-02 13:52:34 -0500
committerEric Eastwood <erice@element.io>2022-08-02 13:52:34 -0500
commit59facea792dfde4be64edcb93ca0678c145b74bf (patch)
treecf9de35a61fa0d77615e9d4ae7ece318f16d3551
parentEnd on exit is already the default expected behavior (diff)
downloadsynapse-59facea792dfde4be64edcb93ca0678c145b74bf.tar.xz
Restore logging current_context (not sure why removed
-rw-r--r--synapse/logging/context.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/logging/context.py b/synapse/logging/context.py

index 6dd1fa525c..dde9c151f5 100644 --- a/synapse/logging/context.py +++ b/synapse/logging/context.py
@@ -328,6 +328,22 @@ class LoggingContext: return self.name @classmethod + def current_context(cls) -> LoggingContextOrSentinel: + """Get the current logging context from thread local storage + This exists for backwards compatibility. ``current_context()`` should be + called directly. + Returns: + LoggingContext: the current logging context + """ + warnings.warn( + "synapse.logging.context.LoggingContext.current_context() is deprecated " + "in favor of synapse.logging.context.current_context().", + DeprecationWarning, + stacklevel=2, + ) + return current_context() + + @classmethod def set_current_context( cls, context: LoggingContextOrSentinel ) -> LoggingContextOrSentinel: