1//! [`Layer`]s that control which spans and events are enabled by the wrapped
2//! subscriber.
3//!
4//! This module contains a number of types that provide implementations of
5//! various strategies for filtering which spans and events are enabled. For
6//! details on filtering spans and events using [`Layer`]s, see the
7//! [`layer` module's documentation].
8//!
9//! [`layer` module's documentation]: crate::layer#filtering-with-layers
10//! [`Layer`]: crate::layer
11mod filter_fn;
1213feature! {
14#![all(feature = "env-filter", feature = "std")]
15mod env;
16pub use self::env::*;
17}
1819feature! {
20#![all(feature = "registry", feature = "std")]
21mod layer_filters;
22pub use self::layer_filters::*;
23}
2425mod level;
2627pub use self::filter_fn::*;
28pub use self::level::{LevelFilter, ParseError as LevelParseError};
2930#[cfg(not(all(feature = "registry", feature = "std")))]
31pub(crate) use self::has_plf_stubs::*;
3233feature! {
34#![any(feature = "std", feature = "alloc")]
35pub mod targets;
36pub use self::targets::Targets;
3738mod directive;
39pub use self::directive::ParseError;
40}
4142/// Stub implementations of the per-layer-filter detection functions for when the
43/// `registry` feature is disabled.
44#[cfg(not(all(feature = "registry", feature = "std")))]
45mod has_plf_stubs {
46pub(crate) fn is_plf_downcast_marker(_: core::any::TypeId) -> bool {
47false
48}
4950/// Does a type implementing `Subscriber` contain any per-layer filters?
51pub(crate) fn subscriber_has_plf<S>(_: &S) -> bool
52where
53S: tracing_core::Subscriber,
54 {
55false
56}
5758/// Does a type implementing `Layer` contain any per-layer filters?
59pub(crate) fn layer_has_plf<L, S>(_: &L) -> bool
60where
61L: crate::Layer<S>,
62 S: tracing_core::Subscriber,
63 {
64false
65}
66}