Skip to content

Commit 5632ef9

Browse files
committed
Remove mention of where the code is
1 parent 39af8d4 commit 5632ef9

4 files changed

Lines changed: 12 additions & 13 deletions

File tree

docs/log_contexts.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -573,12 +573,11 @@ the tokio runtime, the current logcontext must be captured and carried along, so
573573
that log records emitted while the future is polled (including any `log::`
574574
records from dependencies, and any Python invoked back from Rust) are attributed
575575
correctly. Don't use a bare `tokio::spawn`. Instead use
576-
`LogContextHandle::capture(py)` plus `LogContextHandle::scope` (in
577-
`rust/src/logging/context.rs`), which capture the caller's logcontext from the
578-
Python side and record it on the spawned task; this is what `create_deferred`
579-
does. `current_context()` returns the task's captured context first, so
580-
`LoggingContextFilter` — and therefore `pyo3-log` — sees the right context on
581-
worker threads without any per-log-record work.
576+
`LogContextHandle::capture(py)` plus `LogContextHandle::scope`, which capture
577+
the caller's logcontext from the Python side and record it on the spawned task;
578+
this is what `create_deferred` does. `current_context()` returns the task's
579+
captured context first, so `LoggingContextFilter` — and therefore `pyo3-log`
580+
sees the right context on worker threads without any per-log-record work.
582581

583582
## Debugging logcontext issues
584583

synapse/logging/context.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ def __bool__(self) -> Literal[False]:
170170
def current_context() -> LoggingContextOrSentinel:
171171
"""Get the current logging context.
172172
173-
The storage lives in the Rust extension (see `rust/src/logging/context.rs`),
174-
which represents "no context" as `None`. This wrapper maps that to
175-
`SENTINEL_CONTEXT`, so callers never see `None`.
173+
The storage lives in the Rust extension, which represents "no context" as
174+
`None`. This wrapper maps that to `SENTINEL_CONTEXT`, so callers never see
175+
`None`.
176176
"""
177177
context = _rust_current_context()
178178
return SENTINEL_CONTEXT if context is None else context

tests/synapse_rust/test_logcontext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"""Tests for logcontext attribution across the Python/Rust boundary.
1414
1515
The current logcontext is stored on the Rust side
16-
(`synapse.synapse_rust.logcontext` / `rust/src/logging/context.rs`), visible
16+
(`synapse.synapse_rust.logcontext`), visible
1717
from both Python (reactor/threadpool threads) and Rust (tokio tasks). These
1818
tests exercise the two guarantees that gives us:
1919

tests/util/test_logcontext.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -732,9 +732,9 @@ class LogContextErrorMessageTestCase(unittest.TestCase):
732732
"""Tests asserting the exact messages passed to `logcontext_error`, and
733733
the conditions that trigger each one.
734734
735-
The implementation lives in Rust (`rust/src/logging/context.rs`). Downstream
736-
log scraping depends on the wording and argument order of these messages, so
737-
accidental changes must fail a test.
735+
The implementation lives in Rust. Downstream log scraping depends on the
736+
wording and argument order of these messages, so accidental changes must
737+
fail a test.
738738
"""
739739

740740
def setUp(self) -> None:

0 commit comments

Comments
 (0)