You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ uname -a
Darwin bivalve.local 20.6.0 Darwin Kernel Version 20.6.0: Wed Jan 12 22:22:42 PST 2022; root:xnu-7195.141.19~2/RELEASE_X86_64 x86_64
Crates
tracing-subscriber
Description
Following the docs for customizing formatters I managed to get a panic with the message this is a bug when using the JSON formatter.
Here's a repro:
use tracing_subscriber::fmt::format::FmtSpan;fnmain(){
tracing::subscriber::set_global_default(subscriber()).expect("failed to set up tracing");
tracing::info_span!("hello dude");}fnsubscriber() -> impl tracing::Subscriber{let format = tracing_subscriber::fmt::format::json();
tracing_subscriber::fmt().event_format(format).with_span_events(FmtSpan::NEW | FmtSpan::CLOSE).finish()}
And here's the panic. Let me know if the full backtrace would be useful.
$ RUST_LOG=info cargo run -q
thread 'main' panicked at 'span 'hello dude' had malformed fields! this is a bug.
error: EOF while parsing a value at line 1 column 0
fields: FormattedFields { fields: "", formatter: tracing_subscriber::fmt::format::DefaultFields, was_ansi: true }', /Users/benl/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.3.15/src/fmt/format/json.rs:197:49
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
The text was updated successfully, but these errors were encountered:
Oh, thanks for the tip. It definitely wasn't clear from the docs or the error message - if there's any way I could contribute to better docs or improving the error message, let me know!
It's a bit tricky to provide better panic messages, but PR to change the panic message to say something along the lines of "this a bug or the appropriate field formatter wasn't used" would be welcome if it was made against the master branch :)
(sorry this is a bit curt, i'm on mobile right now.)
Bug Report
Version
Platform
Crates
tracing-subscriber
Description
Following the docs for customizing formatters I managed to get a panic with the message
this is a bug
when using the JSON formatter.Here's a repro:
And here's the panic. Let me know if the full backtrace would be useful.
The text was updated successfully, but these errors were encountered: