From 761ca1129519b05fae15df9b99cc004e76112087 Mon Sep 17 00:00:00 2001 From: lokka30 <59464084+lokka30@users.noreply.github.com> Date: Fri, 25 Oct 2024 23:42:08 +0800 Subject: [PATCH] connection_cache: alter favicon logging (#185) * connection_cache: alter favicon logging * connection_cache: cargo fmt --- pumpkin/src/server/connection_cache.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/pumpkin/src/server/connection_cache.rs b/pumpkin/src/server/connection_cache.rs index 5f9cb4c30..a8fa05d68 100644 --- a/pumpkin/src/server/connection_cache.rs +++ b/pumpkin/src/server/connection_cache.rs @@ -107,9 +107,25 @@ impl CachedStatus { pub fn build_response(config: &BasicConfiguration) -> StatusResponse { let icon = if config.use_favicon { let icon_path = &config.favicon_path; - log::info!("Loading server favicon from '{}'", icon_path); + log::debug!("Loading server favicon from '{}'", icon_path); match load_icon_from_file(icon_path).or_else(|err| { - log::warn!("Failed to load icon from '{}': {}", icon_path, err); + if let Some(io_err) = err.downcast_ref::() { + if io_err.kind() == std::io::ErrorKind::NotFound { + log::info!("Favicon '{}' not found; using default icon.", icon_path); + } else { + log::error!( + "Unable to load favicon at '{}': I/O error - {}; using default icon.", + icon_path, + io_err + ); + } + } else { + log::error!( + "Unable to load favicon at '{}': other error - {}; using default icon.", + icon_path, + err + ); + } load_icon_from_bytes(DEFAULT_ICON) }) { Ok(result) => Some(result),