diff options
author | Erik Johnston <erik@matrix.org> | 2020-07-14 10:07:57 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2020-07-14 10:07:57 +0100 |
commit | b4334ff71a4b71fa1324e9641ca8f36a96481e02 (patch) | |
tree | d1041d403f8899ecd676c47477f10794b9a34383 | |
parent | Join persist events bg job with requests (diff) | |
download | synapse-b4334ff71a4b71fa1324e9641ca8f36a96481e02.tar.xz |
Handle empty suffixes in nested_logging_context
-rw-r--r-- | synapse/logging/context.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/synapse/logging/context.py b/synapse/logging/context.py index 8b9c4e38bd..e1d63e6db3 100644 --- a/synapse/logging/context.py +++ b/synapse/logging/context.py @@ -659,9 +659,10 @@ def nested_logging_context( context = parent_context # type: LoggingContextOrSentinel else: context = current_context() - return LoggingContext( - parent_context=context, request=str(context.request) + "-" + suffix - ) + name = str(context.request) + if suffix: + name = name + "-" + suffix + return LoggingContext(parent_context=context, request=name) def preserve_fn(f): |