#![allow(unused_macros)]
#[cfg(feature = "tracing")]
macro_rules! trace {
($($tt:tt)*) => { tracing::trace!($($tt)*) }
}
#[cfg(feature = "tracing")]
macro_rules! debug {
($($tt:tt)*) => { tracing::debug!($($tt)*) }
}
#[cfg(feature = "tracing")]
macro_rules! warn {
($($tt:tt)*) => { tracing::warn!($($tt)*) }
}
#[cfg(not(feature = "tracing"))]
macro_rules! trace {
($($tt:tt)*) => {};
}
#[cfg(not(feature = "tracing"))]
macro_rules! debug {
($($tt:tt)*) => {};
}
#[cfg(not(feature = "tracing"))]
macro_rules! warn {
($($tt:tt)*) => {};
}
#[cfg(all(test, feature = "tracing"))]
pub(crate) struct SinkSubscriber;
#[cfg(all(test, feature = "tracing"))]
impl ::tracing::Subscriber for SinkSubscriber {
fn enabled(&self, _: &::tracing::Metadata<'_>) -> bool {
true
}
fn new_span(&self, _: &::tracing::span::Attributes<'_>) -> ::tracing::span::Id {
::tracing::span::Id::from_u64(1)
}
fn record(&self, _: &::tracing::span::Id, _: &::tracing::span::Record<'_>) {}
fn record_follows_from(&self, _: &::tracing::span::Id, _: &::tracing::span::Id) {}
fn event(&self, _: &::tracing::Event<'_>) {}
fn enter(&self, _: &::tracing::span::Id) {}
fn exit(&self, _: &::tracing::span::Id) {}
}
#[cfg(all(test, feature = "tracing"))]
#[test]
fn sink_subscriber_covers_all_methods() {
let _guard = ::tracing::subscriber::set_default(SinkSubscriber);
::tracing::trace!("cover event path");
let span = ::tracing::trace_span!("cover_span", x = ::tracing::field::Empty);
let _entered = span.enter();
span.record("x", 42);
let other = ::tracing::trace_span!("other_span");
span.follows_from(other.id());
}