Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I know there is probably a crate for this. Whatever.
- Loading branch information
mutexdeveloper
committed
Jan 28, 2023
1 parent
80d6bbf
commit 3e50e03
Showing
3 changed files
with
61 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use colored::Colorize; | ||
use strum_macros::EnumIter; | ||
|
||
/// Log writing priority | ||
/// | ||
/// High: RED | ||
/// | ||
/// Medium: Bright yellow | ||
/// | ||
/// Low: Fading yellow | ||
/// | ||
/// Info: Purple | ||
#[derive(EnumIter, Debug)] | ||
pub enum Priority { | ||
High, | ||
Medium, | ||
Low, | ||
Info | ||
|
||
} | ||
/// Write to log ( stdout ) | ||
pub fn write(message: String, priority: Priority) { | ||
match priority { | ||
Priority::High => { | ||
println!("[ERROR]: {}\n", message.red()) | ||
} | ||
|
||
Priority::Medium => { | ||
println!("[ERROR]: {}\n", message.truecolor(255, 255, 0)) | ||
} | ||
|
||
Priority::Low => { | ||
println!("[ERROR]: {}\n", message.truecolor(177, 177, 0) ) | ||
} | ||
|
||
Priority::Info => { | ||
println!("[LOG]: {}\n", message.truecolor(170, 62, 255)) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters