summary refs log tree commit diff
path: root/tests/util/test_logcontext.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2018-09-27 11:25:34 +0100
committerGitHub <noreply@github.com>2018-09-27 11:25:34 +0100
commit4a15a3e4d539dcea9a4a57e7cd800a926f2a17c3 (patch)
tree16809ad2b72129c39cac4ffda13dbe32bfca7492 /tests/util/test_logcontext.py
parentdocstrings and unittests for storage.state (#3958) (diff)
downloadsynapse-4a15a3e4d539dcea9a4a57e7cd800a926f2a17c3.tar.xz
Include eventid in log lines when processing incoming federation transactions (#3959)
when processing incoming transactions, it can be hard to see what's going on,
because we process a bunch of stuff in parallel, and because we may end up
recursively working our way through a chain of three or four events.

This commit creates a way to use logcontexts to add the relevant event ids to
the log lines.
Diffstat (limited to '')
-rw-r--r--tests/util/test_logcontext.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/util/test_logcontext.py b/tests/util/test_logcontext.py
index 4633db77b3..8adaee3c8d 100644
--- a/tests/util/test_logcontext.py
+++ b/tests/util/test_logcontext.py
@@ -159,6 +159,11 @@ class LoggingContextTestCase(unittest.TestCase):
             self.assertEqual(r, "bum")
             self._check_test_key("one")
 
+    def test_nested_logging_context(self):
+        with LoggingContext(request="foo"):
+            nested_context = logcontext.nested_logging_context(suffix="bar")
+            self.assertEqual(nested_context.request, "foo-bar")
+
 
 # a function which returns a deferred which has been "called", but
 # which had a function which returned another incomplete deferred on