Only show HTTP/2 warning in verbose mode

This commit is contained in:
FliegendeWurst 2021-05-18 08:47:52 +02:00
parent b23192e7bc
commit ac02493dbd
2 changed files with 5 additions and 2 deletions

View File

@ -118,6 +118,9 @@ macro_rules! warning {
(format => $($e:expr),+) => { (format => $($e:expr),+) => {
log!(0, "Warning: {}", format!($($e),+).bright_yellow()); log!(0, "Warning: {}", format!($($e),+).bright_yellow());
}; };
($lvl:expr; $($e:expr),+) => {
log!($lvl, "Warning: {}", format!($($e),+).bright_yellow());
}
} }
macro_rules! error { macro_rules! error {

View File

@ -110,7 +110,7 @@ impl ILIAS {
match result { match result {
Ok(x) => return Ok(x), Ok(x) => return Ok(x),
Err(e) if attempt <= 3 && error_is_http2(&e) => { Err(e) if attempt <= 3 && error_is_http2(&e) => {
warning!("encountered HTTP/2 NO_ERROR, retrying download.."); warning!(1; "encountered HTTP/2 NO_ERROR, retrying download..");
continue continue
}, },
Err(e) => return Err(e.into()) Err(e) => return Err(e.into())
@ -127,7 +127,7 @@ impl ILIAS {
match result { match result {
Ok(x) => return Ok(x), Ok(x) => return Ok(x),
Err(e) if attempt <= 3 && error_is_http2(&e) => { Err(e) if attempt <= 3 && error_is_http2(&e) => {
warning!("encountered HTTP/2 NO_ERROR, retrying HEAD request.."); warning!(1; "encountered HTTP/2 NO_ERROR, retrying HEAD request..");
continue continue
}, },
Err(e) => return Err(e) Err(e) => return Err(e)