mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 11:06:07 -04:00
Preserve logging context in a few more places, drop the logging context after it has been stashed to reduce potential for confusion
This commit is contained in:
parent
3e54d70ae2
commit
97c7c34f6f
4 changed files with 37 additions and 22 deletions
|
@ -18,6 +18,9 @@ class LoggingContext(object):
|
|||
|
||||
__slots__ = []
|
||||
|
||||
def __str__(self):
|
||||
return "sentinel"
|
||||
|
||||
def copy_to(self, record):
|
||||
pass
|
||||
|
||||
|
@ -102,6 +105,7 @@ class PreserveLoggingContext(object):
|
|||
def __enter__(self):
|
||||
"""Captures the current logging context"""
|
||||
self.current_context = LoggingContext.current_context()
|
||||
LoggingContext.thread_local.current_context = LoggingContext.sentinel
|
||||
|
||||
def __exit__(self, type, value, traceback):
|
||||
"""Restores the current logging context"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue