#[repr(u8)]pub enum LogLevel {
Emergency = 0,
Alert = 1,
Critical = 2,
Error = 3,
Warning = 4,
Notice = 5,
Info = 6,
Debug = 7,
}Expand description
日志级别枚举
定义了从 Emergency (最高优先级) 到 Debug (最低优先级) 的八个优先级。
这些级别与 Linux 内核的 KERN_* 常量兼容。
§级别语义
- Emergency (紧急): 系统不可用
- Alert (警报): 必须立即采取行动
- Critical (关键): 关键状况
- Error (错误): 错误状况
- Warning (警告): 警告状况
- Notice (通知): 正常但重要的状况
- Info (信息): 信息性消息
- Debug (调试): 调试级别的消息
Variants§
Emergency = 0
系统不可用
Alert = 1
必须立即采取行动
Critical = 2
关键状况
Error = 3
错误状况
Warning = 4
警告状况
Notice = 5
正常但重要的状况
Info = 6
信息性消息
Debug = 7
调试级别的消息
Implementations§
Source§impl LogLevel
impl LogLevel
Sourcepub(super) const fn color_code(&self) -> &'static str
pub(super) const fn color_code(&self) -> &'static str
返回此日志级别对应的 ANSI 颜色代码
§颜色映射
- Emergency/Alert/Critical: 亮红色
- Error: 红色
- Warning: 黄色
- Notice: 亮白色
- Info: 白色
- Debug: 灰色
Sourcepub(super) const fn reset_color_code(&self) -> &'static str
pub(super) const fn reset_color_code(&self) -> &'static str
返回 ANSI 颜色重置代码
Trait Implementations§
Source§impl Ord for LogLevel
impl Ord for LogLevel
Source§impl PartialOrd for LogLevel
impl PartialOrd for LogLevel
impl Copy for LogLevel
impl Eq for LogLevel
impl StructuralPartialEq for LogLevel
Auto Trait Implementations§
impl Freeze for LogLevel
impl RefUnwindSafe for LogLevel
impl Send for LogLevel
impl Sync for LogLevel
impl Unpin for LogLevel
impl UnwindSafe for LogLevel
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)§impl<Q, K> Comparable<K> for Qwhere
Q: Ord + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Comparable<K> for Qwhere
Q: Ord + ?Sized,
K: Borrow<Q> + ?Sized,
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.