reduce more unnecessary logging and improve a tad

dead servers in rooms are not relevant to log, keep it as info/debug

Signed-off-by: girlbossceo <june@girlboss.ceo>
This commit is contained in:
girlbossceo 2023-10-28 23:40:44 -04:00
parent 64084fb2d0
commit 6931f4b778

View file

@ -262,14 +262,14 @@ where
debug!("Getting response bytes from {destination}"); debug!("Getting response bytes from {destination}");
let body = response.bytes().await.unwrap_or_else(|e| { let body = response.bytes().await.unwrap_or_else(|e| {
warn!("server error {}", e); info!("server error {}", e);
Vec::new().into() Vec::new().into()
}); // TODO: handle timeout }); // TODO: handle timeout
debug!("Got response bytes from {destination}"); debug!("Got response bytes from {destination}");
if !status.is_success() { if !status.is_success() {
warn!( debug!(
"{} {}: {}", "Response not successful\n{} {}: {}",
url, url,
status, status,
String::from_utf8_lossy(&body) String::from_utf8_lossy(&body)
@ -314,29 +314,31 @@ where
} }
} }
Err(e) => { Err(e) => {
if e.is_timeout() { // we do not need to log that servers in a room are dead, this is normal in public rooms and just spams the logs.
info!( match e.is_timeout() {
true => info!(
"Timed out sending request to {} at {}: {}", "Timed out sending request to {} at {}: {}",
destination, actual_destination_str, e destination, actual_destination_str, e
); ),
} else if e.is_redirect() { false => match e.is_connect() {
info!( true => info!(
"Failed to connect to {} at {}: {}",
destination, actual_destination_str, e
),
false => match e.is_redirect() {
true => info!(
"Redirect loop sending request to {} at {}: {}\nFinal URL: {:?}", "Redirect loop sending request to {} at {}: {}\nFinal URL: {:?}",
destination, destination,
actual_destination_str, actual_destination_str,
e, e,
e.url() e.url()
); ),
} else if e.is_connect() { false => warn!(
info!(
"Failed to connect to {} at {}: {}",
destination, actual_destination_str, e
);
} else {
warn!(
"Could not send request to {} at {}: {}", "Could not send request to {} at {}: {}",
destination, actual_destination_str, e destination, actual_destination_str, e
); ),
},
},
} }
Err(e.into()) Err(e.into())
} }
@ -418,7 +420,10 @@ async fn find_actual_destination(destination: &'_ ServerName) -> (FedDest, FedDe
), ),
); );
} else { } else {
warn!("Using SRV record, but could not resolve to IP"); debug!(
"Using SRV record {}, but could not resolve to IP",
hostname_override.hostname()
);
} }
if let Some(port) = force_port { if let Some(port) = force_port {
@ -460,7 +465,10 @@ async fn find_actual_destination(destination: &'_ ServerName) -> (FedDest, FedDe
), ),
); );
} else { } else {
warn!("Using SRV record, but could not resolve to IP"); debug!(
"Using SRV record {}, but could not resolve to IP",
hostname_override.hostname()
);
} }
if let Some(port) = force_port { if let Some(port) = force_port {