// file: crates/ksp-logging-lib/src/macros.rs // version: 2 /// Emits a KSP error event with an explicit owning target. #[macro_export] macro_rules! error { (target: $target:expr, $($argument:tt)+) => {{ $crate::tracing::error!(target: $target, $($argument)+); }}; } /// Emits a KSP warning event with an explicit owning target. #[macro_export] macro_rules! warn { (target: $target:expr, $($argument:tt)+) => {{ $crate::tracing::warn!(target: $target, $($argument)+); }}; } /// Emits a KSP informational event with an explicit owning target. #[macro_export] macro_rules! info { (target: $target:expr, $($argument:tt)+) => {{ $crate::tracing::info!(target: $target, $($argument)+); }}; } /// Emits a KSP debug event with an explicit owning target. #[macro_export] macro_rules! debug { (target: $target:expr, $($argument:tt)+) => {{ $crate::tracing::debug!(target: $target, $($argument)+); }}; } /// Emits a KSP trace event with an explicit owning target. #[macro_export] macro_rules! trace { (target: $target:expr, $($argument:tt)+) => {{ $crate::tracing::trace!(target: $target, $($argument)+); }}; } /// Creates a KSP error span with an explicit owning target. #[macro_export] macro_rules! error_span { (target: $target:expr, $name:expr) => {{ $crate::Span::__from_tracing($crate::tracing::error_span!(target: $target, $name)) }}; (target: $target:expr, $name:expr, $($field:tt)+) => {{ $crate::Span::__from_tracing($crate::tracing::error_span!(target: $target, $name, $($field)+)) }}; } /// Creates a KSP warning span with an explicit owning target. #[macro_export] macro_rules! warn_span { (target: $target:expr, $name:expr) => {{ $crate::Span::__from_tracing($crate::tracing::warn_span!(target: $target, $name)) }}; (target: $target:expr, $name:expr, $($field:tt)+) => {{ $crate::Span::__from_tracing($crate::tracing::warn_span!(target: $target, $name, $($field)+)) }}; } /// Creates a KSP informational span with an explicit owning target. #[macro_export] macro_rules! info_span { (target: $target:expr, $name:expr) => {{ $crate::Span::__from_tracing($crate::tracing::info_span!(target: $target, $name)) }}; (target: $target:expr, $name:expr, $($field:tt)+) => {{ $crate::Span::__from_tracing($crate::tracing::info_span!(target: $target, $name, $($field)+)) }}; } /// Creates a KSP debug span with an explicit owning target. #[macro_export] macro_rules! debug_span { (target: $target:expr, $name:expr) => {{ $crate::Span::__from_tracing($crate::tracing::debug_span!(target: $target, $name)) }}; (target: $target:expr, $name:expr, $($field:tt)+) => {{ $crate::Span::__from_tracing($crate::tracing::debug_span!(target: $target, $name, $($field)+)) }}; } /// Creates a KSP trace span with an explicit owning target. #[macro_export] macro_rules! trace_span { (target: $target:expr, $name:expr) => {{ $crate::Span::__from_tracing($crate::tracing::trace_span!(target: $target, $name)) }}; (target: $target:expr, $name:expr, $($field:tt)+) => {{ $crate::Span::__from_tracing($crate::tracing::trace_span!(target: $target, $name, $($field)+)) }}; }