mirror of
https://github.com/FliegendeWurst/KIT-ILIAS-downloader.git
synced 2024-08-28 04:04:18 +00:00
Fix logging when the progress bar is enabled
This commit is contained in:
parent
044caf497c
commit
6d4a1903fb
21
src/cli.rs
21
src/cli.rs
@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
use std::{path::PathBuf, sync::atomic::{AtomicBool, AtomicUsize}};
|
use std::{path::PathBuf, sync::atomic::{AtomicBool, AtomicUsize}};
|
||||||
|
|
||||||
use anyhow::{anyhow, Context, Result};
|
#[cfg(feature = "keyring-auth")]
|
||||||
|
use anyhow::anyhow;
|
||||||
|
use anyhow::{Context, Result};
|
||||||
|
#[cfg(feature = "keyring-auth")]
|
||||||
use colored::Colorize as _;
|
use colored::Colorize as _;
|
||||||
use indicatif::ProgressBar;
|
use indicatif::ProgressBar;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
@ -92,37 +95,37 @@ macro_rules! log {
|
|||||||
|
|
||||||
macro_rules! info {
|
macro_rules! info {
|
||||||
($t:tt) => {
|
($t:tt) => {
|
||||||
println!($t);
|
log!(0, $t);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! success {
|
macro_rules! success {
|
||||||
($t:tt) => {
|
($t:tt) => {
|
||||||
println!("{}", format!($t).bright_green());
|
log!(0, "{}", format!($t).bright_green());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! warning {
|
macro_rules! warning {
|
||||||
($e:expr) => {
|
($e:expr) => {
|
||||||
println!("Warning: {}", format!("{:?}", $e).bright_yellow());
|
log!(0, "Warning: {}", format!("{:?}", $e).bright_yellow());
|
||||||
};
|
};
|
||||||
($msg:expr, $e:expr) => {
|
($msg:expr, $e:expr) => {
|
||||||
println!("Warning: {}", format!("{} {:?}", $msg, $e).bright_yellow());
|
log!(0, "Warning: {}", format!("{} {:?}", $msg, $e).bright_yellow());
|
||||||
};
|
};
|
||||||
($msg1:expr, $msg2:expr, $e:expr) => {
|
($msg1:expr, $msg2:expr, $e:expr) => {
|
||||||
println!("Warning: {}", format!("{} {} {:?}", $msg1, $msg2, $e).bright_yellow());
|
log!(0, "Warning: {}", format!("{} {} {:?}", $msg1, $msg2, $e).bright_yellow());
|
||||||
};
|
};
|
||||||
(format => $($e:expr),+) => {
|
(format => $($e:expr),+) => {
|
||||||
println!("Warning: {}", format!($($e),+).bright_yellow());
|
log!(0, "Warning: {}", format!($($e),+).bright_yellow());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! error {
|
macro_rules! error {
|
||||||
($($prefix:expr),+; $e:expr) => {
|
($($prefix:expr),+; $e:expr) => {
|
||||||
println!("{}: {}", format!($($prefix),+), format!("{:?}", $e).bright_red());
|
log!(0, "{}: {}", format!($($prefix),+), format!("{:?}", $e).bright_red());
|
||||||
};
|
};
|
||||||
($e:expr) => {
|
($e:expr) => {
|
||||||
println!("Error: {}", format!("{:?}", $e).bright_red());
|
log!(0, "Error: {}", format!("{:?}", $e).bright_red());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user