Skip to main content

ptrs/
log.rs

1/// Trace-level logging (gated on `test` or `debug` feature).
2#[macro_export]
3macro_rules! trace {
4    ($($tts:tt)*) => {
5        #[cfg(any(test, feature="debug"))]
6        tracing::trace!($($tts)*)
7    }
8}
9
10/// Debug-level logging (gated on `test` or `debug` feature).
11#[macro_export]
12macro_rules! debug {
13    ($($tts:tt)*) => {
14        #[cfg(any(test, feature="debug"))]
15        tracing::debug!($($tts)*)
16    }
17}
18
19/// Warning-level logging.
20#[macro_export]
21macro_rules! warn {
22    ($($tts:tt)*) => {
23        tracing::warn!($($tts)*)
24    }
25}
26
27/// Info-level logging.
28#[macro_export]
29macro_rules! info {
30    ($($tts:tt)*) => {
31        tracing::info!($($tts)*)
32    }
33}
34
35/// Error-level logging.
36#[macro_export]
37macro_rules! error {
38    ($($tts:tt)*) => {
39        tracing::error!($($tts)*)
40    }
41}
42
43/// Trace-level span (gated on `test` or `debug` feature).
44#[macro_export]
45macro_rules! trace_span {
46    ($($tts:tt)*) => {
47        #[cfg(any(test, feature="debug"))]
48        tracing::trace_span!($($tts)*)
49    }
50}
51
52/// Debug-level span (gated on `test` or `debug` feature).
53#[macro_export]
54macro_rules! debug_span {
55    ($($tts:tt)*) => {
56        #[cfg(any(test, feature="debug"))]
57        tracing::debug_span!($($tts)*)
58    }
59}
60
61/// Warning-level span.
62#[macro_export]
63macro_rules! warn_span {
64    ($($tts:tt)*) => {
65        tracing::warn_span!($($tts)*)
66    }
67}
68
69/// Info-level span.
70#[macro_export]
71macro_rules! info_span {
72    ($($tts:tt)*) => {
73        tracing::info_span!($($tts)*)
74    }
75}
76
77/// Error-level span.
78#[macro_export]
79macro_rules! error_span {
80    ($($tts:tt)*) => {
81        tracing::error_span!($($tts)*)
82    }
83}