mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-15 22:42:23 +01:00
Robustness fix for logcontext filter
Make the logcontext filter not explode if it somehow ends up with a logcontext of None, since that infinite-loops the whole logging system.
This commit is contained in:
parent
80bf7d3580
commit
55e6bdf287
1 changed files with 7 additions and 1 deletions
|
@ -385,7 +385,13 @@ class LoggingContextFilter(logging.Filter):
|
|||
context = LoggingContext.current_context()
|
||||
for key, value in self.defaults.items():
|
||||
setattr(record, key, value)
|
||||
context.copy_to(record)
|
||||
|
||||
# context should never be None, but if it somehow ends up being, then
|
||||
# we end up in a death spiral of infinite loops, so let's check, for
|
||||
# robustness' sake.
|
||||
if context is not None:
|
||||
context.copy_to(record)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue