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:
|