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 |
11 | mod filter_fn; |
12 | |
13 | feature! { |
14 | #![all(feature = "env-filter" , feature = "std" )] |
15 | mod env; |
16 | pub use self::env::*; |
17 | } |
18 | |
19 | feature! { |
20 | #![all(feature = "registry" , feature = "std" )] |
21 | mod layer_filters; |
22 | pub use self::layer_filters::*; |
23 | } |
24 | |
25 | mod level; |
26 | |
27 | pub use self::filter_fn::*; |
28 | pub use self::level::{LevelFilter, ParseError as LevelParseError}; |
29 | |
30 | #[cfg (not(all(feature = "registry" , feature = "std" )))] |
31 | pub(crate) use self::has_plf_stubs::*; |
32 | |
33 | feature! { |
34 | #![any(feature = "std" , feature = "alloc" )] |
35 | pub mod targets; |
36 | pub use self::targets::Targets; |
37 | |
38 | mod directive; |
39 | pub use self::directive::ParseError; |
40 | } |
41 | |
42 | /// Stub implementations of the per-layer-fitler detection functions for when the |
43 | /// `registry` feature is disabled. |
44 | #[cfg (not(all(feature = "registry" , feature = "std" )))] |
45 | mod has_plf_stubs { |
46 | pub(crate) fn is_plf_downcast_marker(_: core::any::TypeId) -> bool { |
47 | false |
48 | } |
49 | |
50 | /// Does a type implementing `Subscriber` contain any per-layer filters? |
51 | pub(crate) fn subscriber_has_plf<S>(_: &S) -> bool |
52 | where |
53 | S: tracing_core::Subscriber, |
54 | { |
55 | false |
56 | } |
57 | |
58 | /// Does a type implementing `Layer` contain any per-layer filters? |
59 | pub(crate) fn layer_has_plf<L, S>(_: &L) -> bool |
60 | where |
61 | L: crate::Layer<S>, |
62 | S: tracing_core::Subscriber, |
63 | { |
64 | false |
65 | } |
66 | } |
67 | |