forked from rust-lang/rustup
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotify.rs
More file actions
36 lines (32 loc) · 867 Bytes
/
Copy pathnotify.rs
File metadata and controls
36 lines (32 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use std::fmt;
use tracing::Level;
#[derive(Debug)]
pub(crate) enum NotificationLevel {
Trace,
Debug,
Info,
Warn,
Error,
}
impl fmt::Display for NotificationLevel {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
NotificationLevel::Trace => "trace",
NotificationLevel::Debug => "debug",
NotificationLevel::Info => "info",
NotificationLevel::Warn => "warn",
NotificationLevel::Error => "error",
})
}
}
impl From<Level> for NotificationLevel {
fn from(level: Level) -> Self {
match level {
Level::TRACE => Self::Trace,
Level::DEBUG => Self::Debug,
Level::INFO => Self::Info,
Level::WARN => Self::Warn,
Level::ERROR => Self::Error,
}
}
}