diff options
author | Erik Johnston <erik@matrix.org> | 2014-11-26 12:06:36 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-11-26 12:06:36 +0000 |
commit | 48ee9ddb22b36f1adc23290e76287a922488596d (patch) | |
tree | d9eccedd90f9c573634c5456cfbbb65684214c6e /synapse/util/logcontext.py | |
parent | Use tagged version of matrix-angular-sdk (diff) | |
parent | Bump version numbers and change log (diff) | |
download | synapse-48ee9ddb22b36f1adc23290e76287a922488596d.tar.xz |
Merge branch 'release-v0.5.1' of github.com:matrix-org/synapse v0.5.1
Diffstat (limited to 'synapse/util/logcontext.py')
-rw-r--r-- | synapse/util/logcontext.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/synapse/util/logcontext.py b/synapse/util/logcontext.py index 2f430a0f19..7d85018d97 100644 --- a/synapse/util/logcontext.py +++ b/synapse/util/logcontext.py @@ -1,6 +1,8 @@ import threading import logging +logger = logging.getLogger(__name__) + class LoggingContext(object): """Additional context for log formatting. Contexts are scoped within a @@ -53,11 +55,14 @@ class LoggingContext(object): None to avoid suppressing any exeptions that were thrown. """ if self.thread_local.current_context is not self: - logging.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 |