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:
raf 2026-01-30 18:31:19 +03:00
commit e6d1b90b97
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
8 changed files with 107 additions and 56 deletions

31
crates/eh-log/src/lib.rs Normal file
View 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)*)) } }