Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
subscriber: fix double space before thread ID with pretty formatter (#…
…1778) Before this PR there was one two many spaces between "on" and "ThreadId" when thread id formatting is enabled but thread name formatting is disabled. There was no issue when both thread name and thread id were enabled. Previous output: ``` 2021-12-15T00:44:05.596510Z ERROR shotover_proxy::transforms::redis::cache: failed to fetch from cache: system.local not a caching table at shotover-proxy/src/transforms/redis/cache.rs:366 on ThreadId(5) in shotover_proxy::server::request with id=5 source="CassandraSource" ``` new output: ``` 2021-12-15T00:44:05.596510Z ERROR shotover_proxy::transforms::redis::cache: failed to fetch from cache: system.local not a caching table at shotover-proxy/src/transforms/redis/cache.rs:366 on ThreadId(5) in shotover_proxy::server::request with id=5 source="CassandraSource" ``` I spent a lot of time working on unittests, I managed to add tests for a lot of related cases but couldnt test the actual case here :/ When I write a test like: ```rust #[test] fn pretty_threads_ids() { let make_writer = MockMakeWriter::default(); let subscriber = crate::fmt::Collector::builder() .pretty() .with_thread_ids(true) .with_writer(make_writer.clone()) .with_ansi(false) .with_timer(MockTime); assert_info_hello_ignore_numeric( subscriber, make_writer, r#" fake time INFO tracing_subscriber::fmt::format::test: hello at tracing-subscriber/src/fmt/format/mod.rs: "#, ) } ``` Inexplicably the thread id is not displayed. Hopefully you can accept the tests I did write as a compromise, the actual fix here is really simple.
- Loading branch information