feat: 封装日志基础设施
This commit is contained in:
@@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user