mirror of
https://github.com/alterware/alterware-launcher.git
synced 2025-12-04 07:17:50 +00:00
logging
This commit is contained in:
18
src/misc.rs
18
src/misc.rs
@@ -26,7 +26,7 @@ pub fn rev_to_int(rev: &str) -> u16 {
|
||||
}
|
||||
|
||||
pub fn fatal_error(error: &str) {
|
||||
println!("\n\n{}:\n{}", "Error".bright_red(), error);
|
||||
crate::println_error!("{}: {}", "Error".bright_red(), error);
|
||||
stdin();
|
||||
std::process::exit(1);
|
||||
}
|
||||
@@ -56,3 +56,19 @@ pub fn pb_style_download(pb: &ProgressBar, state: bool) {
|
||||
pub fn cute_path(path: &Path) -> String {
|
||||
path.to_str().unwrap().replace('\\', "/")
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! println_info {
|
||||
($($arg:tt)*) => {{
|
||||
println!($($arg)*);
|
||||
info!($($arg)*);
|
||||
}}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! println_error {
|
||||
($($arg:tt)*) => {{
|
||||
eprintln!($($arg)*);
|
||||
error!($($arg)*);
|
||||
}}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user