Merge pull request #3007 from matrix-org/rav/warn_on_logcontext_fail

Make 'unexpected logging context' into warnings
This commit is contained in:
Richard van der Hoff 2018-05-03 15:10:04 +01:00 committed by GitHub
commit 966686c845
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -164,7 +164,7 @@ class LoggingContext(object):
current = self.set_current_context(self.previous_context) current = self.set_current_context(self.previous_context)
if current is not self: if current is not self:
if current is self.sentinel: if current is self.sentinel:
logger.debug("Expected logging context %s has been lost", self) logger.warn("Expected logging context %s has been lost", self)
else: else:
logger.warn( logger.warn(
"Current logging context %s is not expected context %s", "Current logging context %s is not expected context %s",
@ -279,7 +279,7 @@ class PreserveLoggingContext(object):
context = LoggingContext.set_current_context(self.current_context) context = LoggingContext.set_current_context(self.current_context)
if context != self.new_context: if context != self.new_context:
logger.debug( logger.warn(
"Unexpected logging context: %s is not %s", "Unexpected logging context: %s is not %s",
context, self.new_context, context, self.new_context,
) )