Restore logging current_context (not sure why removed
This commit is contained in:
@@ -327,6 +327,22 @@ class LoggingContext:
|
||||
def __str__(self) -> str:
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user