tracing icon indicating copy to clipboard operation
tracing copied to clipboard

It's not possible to check the source of a `tracing_subscriber::util::TryInitError`

Open Nemo157 opened this issue 8 months ago • 1 comments

Bug Report

Version

tracing-attributes v0.1.27 (proc-macro)
tracing-core v0.1.32
tracing-log v0.2.0
tracing-serde v0.1.3
tracing-subscriber v0.3.18
tracing v0.1.40

Crates

tracing-subscriber

Description

https://github.com/tokio-rs/tracing/blob/8ba80ae82371638aa749436e4f284b65adf9ff90/tracing-subscriber/src/util.rs#L150-L152

This bypasses returning the direct source of the error (Some(&self.inner)), so for example there's no way to let Some(source) = try_init_error.source() && source.is::<tracing_log::log_tracer::SetLoggerError>() to check if the failure reason was initializing the tracing-log logger.

Nemo157 avatar Nov 24 '23 13:11 Nemo157

ah, that doesn't seem great. well, we'd accept a PR fixing this, if you have the time!

davidbarsky avatar Nov 25 '23 16:11 davidbarsky