Name Description Size
field
filter
fmt
layer
lib.rs 9482
macros.rs 566
prelude.rs The `tracing-subscriber` prelude. This brings into scope a number of extension traits that define methods on types defined here and in other crates. 584
registry
reload.rs Wrapper for a `Layer` to allow it to be dynamically reloaded. This module provides a [`Layer` type] implementing the [`Layer` trait] or [`Filter` trait] which wraps another type implementing the corresponding trait. This allows the wrapped type to be replaced with another instance of that type at runtime. This can be used in cases where a subset of `Layer` or `Filter` functionality should be dynamically reconfigured, such as when filtering directives may change at runtime. Note that this layer introduces a (relatively small) amount of overhead, and should thus only be used as needed. # Examples Reloading a [global filtering](crate::layer#global-filtering) layer: ```rust # use tracing::info; use tracing_subscriber::{filter, fmt, reload, prelude::*}; let filter = filter::LevelFilter::WARN; let (filter, reload_handle) = reload::Layer::new(filter); tracing_subscriber::registry() .with(filter) .with(fmt::Layer::default()) .init(); # # // specifying the Registry type is required # let _: &reload::Handle<filter::LevelFilter, tracing_subscriber::Registry> = &reload_handle; # info!("This will be ignored"); reload_handle.modify(|filter| *filter = filter::LevelFilter::INFO); info!("This will be logged"); ``` Reloading a [`Filtered`](crate::filter::Filtered) layer: ```rust # use tracing::info; use tracing_subscriber::{filter, fmt, reload, prelude::*}; let filtered_layer = fmt::Layer::default().with_filter(filter::LevelFilter::WARN); let (filtered_layer, reload_handle) = reload::Layer::new(filtered_layer); # # // specifying the Registry type is required # let _: &reload::Handle<filter::Filtered<fmt::Layer<tracing_subscriber::Registry>, # filter::LevelFilter, tracing_subscriber::Registry>,tracing_subscriber::Registry> # = &reload_handle; # tracing_subscriber::registry() .with(filtered_layer) .init(); info!("This will be ignored"); reload_handle.modify(|layer| *layer.filter_mut() = filter::LevelFilter::INFO); info!("This will be logged"); ``` ## Note The [`Layer`] implementation is unable to implement downcasting functionality, so certain [`Layer`] will fail to downcast if wrapped in a `reload::Layer`. If you only want to be able to dynamically change the `Filter` on a layer, prefer wrapping that `Filter` in the `reload::Layer`. [`Filter` trait]: crate::layer::Filter [`Layer` type]: Layer [`Layer` trait]: super::layer::Layer 13213
sync.rs Abstracts over sync primitive implementations. Optionally, we allow the Rust standard library's `RwLock` to be replaced with the `parking_lot` crate's implementation. This may provide improved performance in some cases. However, the `parking_lot` dependency is an opt-in feature flag. Because `parking_lot::RwLock` has a slightly different API than `std::sync::RwLock` (it does not support poisoning on panics), we wrap it with a type that provides the same method signatures. This allows us to transparently swap `parking_lot` in without changing code at the callsite. 2001
util.rs Extension traits and other utilities to make working with subscribers more ergonomic. 5761