-
Notifications
You must be signed in to change notification settings - Fork 847
Description
Feature Request
Crates
tracing-subscriber
Motivation
I'm currently using reload::Layer with a Filtered layer to activate different tracing levels for various modules dynamically. However, it's not currently possible to modify the currently span event configuration since with_span_events can only be set when creating the layer. Due to #1629 , I'm not able to completely reload the layer.
The fmt::Layer has a few methods to mutably change aspects of the layer, namely writer_mut and set_ansi.
It seems like adding a set_span_events method in a similar vein to set_ansi would make sense?
The downside to this approach is that a span configuration could be changed mid-span, causing a CLOSE for an already entered span to not be emitted. I think this is acceptable, however, due to the reload layer already having the flexibility to change the underlying layer/writer/filter, but this will just need to be clear in docs.
I'm happy to implement this if the API makes sense! :)
Proposal
Add a new set_span_events method to tracing_subscriber::fmt::Layer
fn set_span_events(&mut self, kind: FmtSpan)Alternatives
Alternative ways to approach this would be to fix #1629. The workarounds present in that issue are not applicable to my use-case as it removes the abilities for other layers to do filtering.