summary refs log tree commit diff
path: root/synapse/util
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2014-11-25 10:57:31 +0000
committerMark Haines <mark.haines@matrix.org>2014-11-25 10:57:31 +0000
commit15099fade5ec9b52e48f952327f1e979b185e7fe (patch)
tree79940ce6ef1d3ff6d5c65eb6a2b2ffd5dbd00376 /synapse/util
parentpip uninstall syweb (diff)
downloadsynapse-15099fade5ec9b52e48f952327f1e979b185e7fe.tar.xz
Drop log level for incorrect logging contexts to WARN if the context is wrong and DEBUG if the context is missing
Diffstat (limited to '')
-rw-r--r--synapse/util/logcontext.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/synapse/util/logcontext.py b/synapse/util/logcontext.py
index 23b3decb45..7d85018d97 100644
--- a/synapse/util/logcontext.py
+++ b/synapse/util/logcontext.py
@@ -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