feat: polish logging if the server is unavailable
This commit is contained in:
parent
1229127101
commit
1bce912a1a
3 changed files with 8 additions and 8 deletions
|
|
@ -235,9 +235,9 @@ async fn handle_status<T: MinecraftServerHandle>(
|
|||
.instrument(span.clone())
|
||||
.await
|
||||
.map_err(|_| tracing::debug!("failed to send pong packet"));
|
||||
let _guard = span.enter();
|
||||
|
||||
tracing::info!(status = "unavailable", "status request");
|
||||
let status = ServerDeploymentStatus::Unavailable(e.get_kind().to_string());
|
||||
tracing::info!(status = ?status, "status request");
|
||||
return Ok(());
|
||||
}
|
||||
};
|
||||
|
|
@ -264,6 +264,7 @@ async fn handle_status<T: MinecraftServerHandle>(
|
|||
status_struct.description.text =
|
||||
format!("{motd}\n§4Offline§r §oJoin to start!§r - {BYE_MESSAGE}");
|
||||
}
|
||||
ServerDeploymentStatus::Unavailable(_) => unreachable!(),
|
||||
};
|
||||
|
||||
mc_server::complete_status_request(client_stream, status_struct).await?;
|
||||
|
|
@ -321,7 +322,7 @@ async fn handle_login<T: MinecraftServerHandle>(
|
|||
|
||||
match traffic.error {
|
||||
Some(e) => {
|
||||
tracing::info!(
|
||||
tracing::warn!(
|
||||
tx = traffic.tx,
|
||||
rx = traffic.rx,
|
||||
err = ?e,
|
||||
|
|
@ -344,6 +345,7 @@ async fn handle_login<T: MinecraftServerHandle>(
|
|||
.await?;
|
||||
mc_server::send_disconnect(client_stream, format!("[\"\",{{\"text\":\"Okayy, §2starting§r the server!\n\n\"}},{{\"text\":\"{BYE_MESSAGE}\"}}]").as_str()).await?;
|
||||
}
|
||||
ServerDeploymentStatus::Unavailable(_) => unreachable!(),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue