#[cfg(feature = "tracing")]
macro_rules! trace_span {
($name:expr $(, $($field:tt)*)?) => {
tracing::info_span!($name $(, $($field)*)?)
};
}
#[cfg(not(feature = "tracing"))]
macro_rules! trace_span {
($name:expr $(, $($field:tt)*)?) => {
$crate::trace::NoopSpan
};
}
#[cfg(feature = "tracing")]
macro_rules! trace_event {
($name:expr, $($key:ident = $value:expr),+ $(,)?) => {
tracing::info!(name: $name, $($key = $value),+)
};
($name:expr) => {
tracing::info!(name: $name)
};
}
#[cfg(not(feature = "tracing"))]
macro_rules! trace_event {
($name:expr, $($key:ident = $value:expr),+ $(,)?) => {
let _ = ($($value,)+);
};
($name:expr) => {};
}
#[cfg(not(feature = "tracing"))]
pub struct NoopSpan;
#[cfg(not(feature = "tracing"))]
impl NoopSpan {
#[inline]
pub fn entered(self) -> Self {
self
}
}