1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#[cfg_attr(not(feature = "enable_log"), doc(hidden))]
pub use tracing::*;

#[cfg(not(feature = "enable_log"))]
pub mod dummy;

#[cfg(feature = "enable_log")]
#[macro_export]
macro_rules! instrument {
    ($lvl:expr, $name:expr, $($fields:tt)*) => {
        let _guard = $crate::span!(target:module_path!(), $lvl, $name, $($fields)*).entered();
    };
    ($lvl:expr, $name:expr) => {
        let _guard = $crate::span!(target:module_path!(), $lvl, $name).entered();
    };
}

#[cfg(not(feature = "enable_log"))]
#[macro_export]
macro_rules! instrument {
    ($lvl:expr, $name:expr, $($fields:tt)*) => {};
    ($lvl:expr, $name:expr) => {};
}