#[allow(unused_macros)]
#[macro_export]
macro_rules! debug {
($($arg:tt)+) => {
#[cfg(feature = "tracing")]
{
tracing::debug!($($arg)+);
}
};
}
#[allow(unused_macros)]
#[macro_export]
macro_rules! debug_span {
($($arg:tt)*) => {
{
#[cfg(feature = "tracing")]
{
let _span = tracing::debug_span!($($arg)+);
_span.entered()
}
}
}
}
#[allow(unused_macros)]
#[macro_export]
macro_rules! instrument_debug_span {
(
$fut:expr,
$($arg:tt)*
) => {
{
#[cfg(feature = "tracing")]
{
use tracing::Instrument;
let span = tracing::debug_span!($($arg)+);
$fut.instrument(span)
}
#[cfg(not(feature = "tracing"))]
{
$fut
}
}
};
}
#[allow(unused_macros)]
#[macro_export]
macro_rules! error {
($($arg:tt)*) => {
#[cfg(feature = "tracing")]
{
tracing::error!($($arg)+);
}
}
}
#[allow(unused_macros)]
#[macro_export]
macro_rules! error_span {
($($arg:tt)*) => {
{
#[cfg(feature = "tracing")]
{
let _span = tracing::error_span!($($arg)+);
_span.entered()
}
}
}
}
#[allow(unused_macros)]
#[macro_export]
macro_rules! instrument_error_span {
(
$fut:expr,
$($arg:tt)*
) => {
{
#[cfg(feature = "tracing")]
{
use tracing::Instrument;
let span = tracing::error_span!($($arg)+);
$fut.instrument(span)
}
#[cfg(not(feature = "tracing"))]
{
$fut
}
}
};
}
#[allow(unused_macros)]
#[macro_export]
macro_rules! info {
($($arg:tt)*) => {
#[cfg(feature = "tracing")]
{
tracing::info!($($arg)+);
}
}
}
#[allow(unused_macros)]
#[macro_export]
macro_rules! info_span {
($($arg:tt)*) => {
{
#[cfg(feature = "tracing")]
{
let _span = tracing::info_span!($($arg)+);
_span.entered()
}
}
}
}
#[allow(unused_macros)]
#[macro_export]
macro_rules! instrument_info_span {
(
$fut:expr,
$($arg:tt)*
) => {
{
#[cfg(feature = "tracing")]
{
use tracing::Instrument;
let span = tracing::info_span!($($arg)+);
$fut.instrument(span)
}
#[cfg(not(feature = "tracing"))]
{
$fut
}
}
};
}
#[allow(unused_macros)]
#[macro_export]
macro_rules! trace {
($($arg:tt)*) => {
#[cfg(feature = "tracing")]
{
tracing::trace!($($arg)+);
}
}
}
#[allow(unused_macros)]
#[macro_export]
macro_rules! trace_span {
($($arg:tt)*) => {
{
#[cfg(feature = "tracing")]
{
let _span = tracing::trace_span!($($arg)+);
_span.entered()
}
}
}
}
#[allow(unused_macros)]
#[macro_export]
macro_rules! instrument_trace_span {
(
$fut:expr,
$($arg:tt)*
) => {
{
#[cfg(feature = "tracing")]
{
use tracing::Instrument;
let span = tracing::trace_span!($($arg)+);
$fut.instrument(span)
}
#[cfg(not(feature = "tracing"))]
{
$fut
}
}
};
}
#[allow(unused_macros)]
#[macro_export]
macro_rules! span {
($($arg:tt)*) => {
{
#[cfg(feature = "tracing")]
{
tracing::span!($($arg)+)
}
}
}
}
#[allow(unused_macros)]
#[macro_export]
macro_rules! warn2 {
($($arg:tt)*) => {
#[cfg(feature = "tracing")]
{
tracing::warn!($($arg)+);
}
}
}
#[allow(unused_macros)]
#[macro_export]
macro_rules! warn_span {
($($arg:tt)*) => {
{
#[cfg(feature = "tracing")]
{
let _span = tracing::warn_span!($($arg)+);
_span.entered()
}
}
}
}
#[allow(unused_macros)]
#[macro_export]
macro_rules! instrument_warn_span {
(
$fut:expr,
$($arg:tt)*
) => {
{
#[cfg(feature = "tracing")]
{
use tracing::Instrument;
let span = tracing::warn_span!($($arg)+);
$fut.instrument(span)
}
#[cfg(not(feature = "tracing"))]
{
$fut
}
}
};
}
#[allow(unused_macros)]
#[macro_export]
macro_rules! instrument_current_span {
(
$fut:expr
) => {{
#[cfg(feature = "tracing")]
{
use tracing::Instrument;
let span = tracing::Span::current();
$fut.instrument(span)
}
#[cfg(not(feature = "tracing"))]
{
$fut
}
}};
}
#[allow(unused_macros)]
#[macro_export]
macro_rules! tokio_spawn {
($fut:expr) => {
tokio::spawn($fut)
};
}
#[allow(unused_imports)]
pub use tokio_spawn;
#[allow(unused_imports)]
pub use debug;
#[allow(unused_imports)]
pub use debug_span;
#[allow(unused_imports)]
pub use instrument_debug_span;
#[allow(unused_imports)]
pub use error;
#[allow(unused_imports)]
pub use error_span;
#[allow(unused_imports)]
pub use instrument_error_span;
#[allow(unused_imports)]
pub use info;
#[allow(unused_imports)]
pub use info_span;
#[allow(unused_imports)]
pub use instrument_info_span;
#[allow(unused_imports)]
pub use trace;
#[allow(unused_imports)]
pub use trace_span;
#[allow(unused_imports)]
pub use instrument_trace_span;
#[allow(unused_imports)]
pub use span;
#[allow(unused_imports)]
pub use warn2;
#[allow(unused_imports)]
pub use warn_span;
#[allow(unused_imports)]
pub use instrument_warn_span;
#[allow(unused_imports)]
pub use instrument_current_span;