tokio-rs / tracing

Application level tracing for Rust.
https://tracing.rs
MIT License
5.4k stars 709 forks source link

Fix deadlock with `tracing-error` + `fmt::Subscriber` #2882

Open mladedav opened 7 months ago

mladedav commented 7 months ago

Motivation

1565

Solution

I've added a method to the FormatFields implementation with a provided default implementation based on what was already in the add_fields method. This is potentially a breaking change in a subtle manner as anyone who has manually implemented the add_fields method will most likely also want to implement this.

When fields should be printed, they are first printed to a new instance and then they are merged with the original.