tracing: pub 导出常用函数及宏

Signed-off-by: Jia Chao <jiac13@chinaunicom.cn>
This commit is contained in:
Jia Chao 2024-07-12 14:46:58 +08:00
parent ee16adb37f
commit edfeda766e
2 changed files with 8 additions and 0 deletions

View File

@ -7,6 +7,9 @@ pub mod util;
/// 包含了一些常用的文件操作函数 /// 包含了一些常用的文件操作函数
pub mod file; pub mod file;
/// 重新导出 tracing 中常用的日志宏,以及 tracing_subscriber 里的格式化和环境过滤器
pub mod tracing;
/// 定义 crate::Error /// 定义 crate::Error
/// 大部分函数返回的错误 /// 大部分函数返回的错误
pub type Error = Box<dyn std::error::Error + Send + Sync>; pub type Error = Box<dyn std::error::Error + Send + Sync>;

5
src/tracing.rs Normal file
View File

@ -0,0 +1,5 @@
/// 引入 tracing 库中的常用宏,用于写入不同级别的日志
pub use tracing::{debug, error, info, trace, warn};
/// 引入 tracing_subscriber 库中的格式化和环境过滤器
pub use tracing_subscriber::{fmt, EnvFilter};