diff --git a/src/lib.rs b/src/lib.rs index 9b34a5e..bec73d3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,6 +7,9 @@ pub mod util; /// 包含了一些常用的文件操作函数 pub mod file; +/// 重新导出 tracing 中常用的日志宏,以及 tracing_subscriber 里的格式化和环境过滤器 +pub mod tracing; + /// 定义 crate::Error /// 大部分函数返回的错误 pub type Error = Box; diff --git a/src/tracing.rs b/src/tracing.rs new file mode 100644 index 0000000..68842ce --- /dev/null +++ b/src/tracing.rs @@ -0,0 +1,5 @@ +/// 引入 tracing 库中的常用宏,用于写入不同级别的日志 +pub use tracing::{debug, error, info, trace, warn}; + +/// 引入 tracing_subscriber 库中的格式化和环境过滤器 +pub use tracing_subscriber::{fmt, EnvFilter};