diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-11-25 10:57:31 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-11-25 10:57:31 +0000 |
commit | 15099fade5ec9b52e48f952327f1e979b185e7fe (patch) | |
tree | 79940ce6ef1d3ff6d5c65eb6a2b2ffd5dbd00376 | |
parent | pip uninstall syweb (diff) | |
download | synapse-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.py | 13 |
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 |