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