pub trait __tracing_subscriber_SubscriberExt: Subscriber + Sealed {
// Provided method
fn with<L>(self, layer: L) -> Layered<L, Self>
where L: Layer<Self>,
Self: Sized { ... }
}
Expand description
Extension trait adding a with(Layer)
combinator to Subscriber
s.
Provided Methods§
fn with<L>(self, layer: L) -> Layered<L, Self>
fn with<L>(self, layer: L) -> Layered<L, Self>
Wraps self
with the provided layer
.
Examples found in repository?
More examples
examples/app/log_layers_ecs.rs (line 90)
80 81 82 83 84 85 86 87 88 89 90 91
fn update_subscriber(app: &mut App, subscriber: BoxedSubscriber) -> BoxedSubscriber {
let (sender, receiver) = mpsc::channel();
let layer = CaptureLayer { sender };
let resource = CapturedLogEvents(receiver);
app.insert_non_send_resource(resource);
app.add_event::<LogEvent>();
app.add_systems(Update, transfer_log_events);
Box::new(subscriber.with(layer))
}