eh: improve error and warning glyphs; move logger to new crate
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I563b37a9f38f8dcec6dda7693ae45e826a6a6964
This commit is contained in:
parent
be3226bc3a
commit
e6d1b90b97
8 changed files with 107 additions and 56 deletions
31
crates/eh-log/src/lib.rs
Normal file
31
crates/eh-log/src/lib.rs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
use std::fmt;
|
||||
|
||||
use yansi::Paint;
|
||||
|
||||
pub fn info(args: fmt::Arguments) {
|
||||
eprintln!(" {} {args}", "->".green().bold());
|
||||
}
|
||||
|
||||
pub fn warn(args: fmt::Arguments) {
|
||||
eprintln!(" {} {args}", "->".yellow().bold());
|
||||
}
|
||||
|
||||
pub fn error(args: fmt::Arguments) {
|
||||
eprintln!(" {} {args}", "!".red().bold());
|
||||
}
|
||||
|
||||
pub fn hint(args: fmt::Arguments) {
|
||||
eprintln!(" {} {args}", "~".yellow().dim());
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! log_info { ($($t:tt)*) => { $crate::info(format_args!($($t)*)) } }
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! log_warn { ($($t:tt)*) => { $crate::warn(format_args!($($t)*)) } }
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! log_error { ($($t:tt)*) => { $crate::error(format_args!($($t)*)) } }
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! log_hint { ($($t:tt)*) => { $crate::hint(format_args!($($t)*)) } }
|
||||
Loading…
Add table
Add a link
Reference in a new issue