add color utils to log suite
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
029e1c630a
commit
877c04de52
2 changed files with 28 additions and 0 deletions
27
src/core/log/color.rs
Normal file
27
src/core/log/color.rs
Normal file
|
@ -0,0 +1,27 @@
|
|||
use super::Level;
|
||||
|
||||
/// @returns (Foreground, Background)
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn html(level: &Level) -> (&'static str, &'static str) {
|
||||
match *level {
|
||||
Level::TRACE => ("#000000", "#A0A0A0"),
|
||||
Level::DEBUG => ("#000000", "#FFFFFF"),
|
||||
Level::ERROR => ("#000000", "#FF0000"),
|
||||
Level::WARN => ("#000000", "#FFFF00"),
|
||||
Level::INFO => ("#FFFFFF", "#008E00"),
|
||||
}
|
||||
}
|
||||
|
||||
/// @returns (Foreground)
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn code_tag(level: &Level) -> &'static str {
|
||||
match *level {
|
||||
Level::TRACE => "#888888",
|
||||
Level::DEBUG => "#C8C8C8",
|
||||
Level::ERROR => "#FF0000",
|
||||
Level::WARN => "#FFFF00",
|
||||
Level::INFO => "#00FF00",
|
||||
}
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
pub mod color;
|
||||
mod reload;
|
||||
|
||||
pub use reload::ReloadHandle;
|
||||
|
|
Loading…
Add table
Reference in a new issue