feat: 封装日志基础设施

This commit is contained in:
爱特每羊队
2026-06-26 18:43:29 +08:00
parent d1f7201f52
commit 8394c5d632
9 changed files with 404 additions and 2 deletions
+22
View File
@@ -0,0 +1,22 @@
#[repr(u8)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum Level {
Off = 0,
Error = 1,
Warn = 2,
Info = 3,
Debug = 4,
Trace = 5,
}
impl Level {
pub fn as_tracing_level(self) -> tracing::Level {
match self {
Level::Off | Level::Error => tracing::Level::ERROR,
Level::Warn => tracing::Level::WARN,
Level::Info => tracing::Level::INFO,
Level::Debug => tracing::Level::DEBUG,
Level::Trace => tracing::Level::TRACE,
}
}
}