From 931a40edab26206d1651ffd3eabeb42264fd964b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20M=C3=BCller?= Date: Sun, 5 Jan 2025 13:28:36 -0800 Subject: [PATCH] subscriber: document Subscriber::with_test_writer() limitations Subscriber::with_test_writer() doesn't compose with any earlier calls of Subscriber::with_writer(), as one would perhaps hope. Rather, both just overwrite the same member. Make sure to add a note of this behavior to make it a bit more obvious. --- tracing-subscriber/src/fmt/fmt_subscriber.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tracing-subscriber/src/fmt/fmt_subscriber.rs b/tracing-subscriber/src/fmt/fmt_subscriber.rs index eec4c3241..605499af1 100644 --- a/tracing-subscriber/src/fmt/fmt_subscriber.rs +++ b/tracing-subscriber/src/fmt/fmt_subscriber.rs @@ -266,6 +266,10 @@ impl Subscriber { /// /// See [`TestWriter`] for additional details. /// + /// # Notes + /// Usage of this method is will overwrite the result of a previous [`with_writer`] invocation; + /// the two do not compose. + /// /// # Examples /// /// Using [`TestWriter`] to let `cargo test` capture test output: