|
|
|
@ -10,31 +10,29 @@ const ERR_SYMBOL: &str = "❌";
|
|
|
|
|
#[macro_export]
|
|
|
|
|
macro_rules! info {
|
|
|
|
|
($($arg:tt)+) => {
|
|
|
|
|
$crate::internal::strings::info_fn(format!($($arg)+));
|
|
|
|
|
$crate::internal::strings::info_fn(&format!($($arg)+));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
|
macro_rules! log {
|
|
|
|
|
($verbose:expr, $($arg:tt)+) => {
|
|
|
|
|
$crate::internal::strings::log_fn(format!("{}:{} {}", file!(), line!(), format!($($arg)+)), $verbose);
|
|
|
|
|
$crate::internal::strings::log_fn(&format!("{}:{} {}", file!(), line!(), format!($($arg)+)), $verbose);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
|
macro_rules! crash {
|
|
|
|
|
($exit_code:expr, $($arg:tt)+) => {
|
|
|
|
|
$crate::internal::strings::crash_fn(format!($($arg)+), $exit_code)
|
|
|
|
|
$crate::internal::strings::crash_fn(&format!($($arg)+), $exit_code)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn info_fn<S: ToString>(msg: S) {
|
|
|
|
|
let msg = msg.to_string();
|
|
|
|
|
pub fn info_fn(msg: &str) {
|
|
|
|
|
println!("{} {}", LOGO_SYMBOL.black(), msg.bold());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn log_fn<S: ToString>(msg: S, verbose: bool) {
|
|
|
|
|
let msg = msg.to_string();
|
|
|
|
|
pub fn log_fn(msg: &str, verbose: bool) {
|
|
|
|
|
if verbose {
|
|
|
|
|
eprintln!(
|
|
|
|
|
"{} {}",
|
|
|
|
@ -47,8 +45,7 @@ pub fn log_fn<S: ToString>(msg: S, verbose: bool) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn crash_fn<S: ToString>(msg: S, exit_code: AppExitCode) {
|
|
|
|
|
let msg = msg.to_string();
|
|
|
|
|
pub fn crash_fn(msg: &str, exit_code: AppExitCode) {
|
|
|
|
|
println!("{} {}", ERR_SYMBOL.red(), msg.bold());
|
|
|
|
|
exit(exit_code as i32);
|
|
|
|
|
}
|
|
|
|
|