tencentcloud_sms/
logging.rs

1/// 日志宏模块
2///
3/// 当 `logging` feature 启用时,使用 tracing 记录日志
4/// 否则,日志调用为空操作(零成本抽象)
5
6#[cfg(feature = "logging")]
7pub use tracing::{debug, error, info, warn};
8
9#[cfg(not(feature = "logging"))]
10/// 空日志 debug 宏 - 当 logging feature 未启用时使用
11#[macro_export]
12macro_rules! log_debug {
13    ($($arg:tt)*) => {{}};
14}
15
16#[cfg(not(feature = "logging"))]
17/// 空日志 info 宏
18#[macro_export]
19macro_rules! log_info {
20    ($($arg:tt)*) => {{}};
21}
22
23#[cfg(not(feature = "logging"))]
24/// 空日志 warn 宏
25#[macro_export]
26macro_rules! log_warn {
27    ($($arg:tt)*) => {{}};
28}
29
30#[cfg(not(feature = "logging"))]
31/// 空日志 error 宏
32#[macro_export]
33macro_rules! log_error {
34    ($($arg:tt)*) => {{}};
35}
36
37// 当 logging feature 未启用时,导出空宏并重命名为标准名称
38#[cfg(not(feature = "logging"))]
39pub use log_debug as debug;
40#[cfg(not(feature = "logging"))]
41pub use log_error as error;
42#[cfg(not(feature = "logging"))]
43pub use log_info as info;
44#[cfg(not(feature = "logging"))]
45pub use log_warn as warn;