use owo_colors::OwoColorize;
pub enum Log<'a> {
Err(&'a str),
Warn(&'a str),
Suc(&'a str),
Info(&'a str),
}
impl<'a> Log<'a> {
pub fn println(self) {
if let Self::Info(str) = self {
println!("{}", str)
} else {
println!("{}", self.to_string())
}
}
}
impl<'a> ToString for Log<'a> {
fn to_string(&self) -> String {
match self {
Self::Err(str) => format!("❌ {}", str).red().to_string(),
Self::Warn(str) => format!("❗ {}", str).yellow().to_string(),
Self::Suc(str) => format!("✅ {}", str).green().to_string(),
Self::Info(str) => format!("📢 {}", str).white().to_string(),
}
}
}