0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-14 16:53:53 +01:00

Drop log level for incorrect logging contexts to WARN if the context is wrong and DEBUG if the context is missing

This commit is contained in:
Mark Haines 2014-11-25 10:57:31 +00:00
parent 6fe5899639
commit 15099fade5

View file

@ -55,11 +55,14 @@ class LoggingContext(object):
None to avoid suppressing any exeptions that were thrown.
"""
if self.thread_local.current_context is not self:
logger.error(
"Current logging context %s is not the expected context %s",
self.thread_local.current_context,
self
)
if self.thread_local.current_context is self.sentinel:
logger.debug("Expected logging context %s has been lost", self)
else:
logger.warn(
"Current logging context %s is not expected context %s",
self.thread_local.current_context,
self
)
self.thread_local.current_context = self.parent_context
self.parent_context = None