bootstrap/utils/
tracing.rs
1#[macro_export]
12macro_rules! trace {
13 ($($tokens:tt)*) => {
14 #[cfg(feature = "tracing")]
15 ::tracing::trace!($($tokens)*)
16 }
17}
18
19#[macro_export]
20macro_rules! debug {
21 ($($tokens:tt)*) => {
22 #[cfg(feature = "tracing")]
23 ::tracing::debug!($($tokens)*)
24 }
25}
26
27#[macro_export]
28macro_rules! warn {
29 ($($tokens:tt)*) => {
30 #[cfg(feature = "tracing")]
31 ::tracing::warn!($($tokens)*)
32 }
33}
34
35#[macro_export]
36macro_rules! info {
37 ($($tokens:tt)*) => {
38 #[cfg(feature = "tracing")]
39 ::tracing::info!($($tokens)*)
40 }
41}
42
43#[macro_export]
44macro_rules! error {
45 ($($tokens:tt)*) => {
46 #[cfg(feature = "tracing")]
47 ::tracing::error!($($tokens)*)
48 }
49}
50
51#[macro_export]
52macro_rules! trace_cmd {
53 ($cmd:expr) => {
54 {
55 use $crate::utils::exec::FormatShortCmd;
56
57 ::tracing::span!(
58 target: "COMMAND",
59 ::tracing::Level::TRACE,
60 "executing command",
61 cmd = $cmd.format_short_cmd(),
62 full_cmd = ?$cmd
63 ).entered()
64 }
65 };
66}