From 0eb332c14d9f245e204954fe3254c9a5cc800441 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Thu, 14 Nov 2024 00:42:54 +0100 Subject: [PATCH] [logging] make message logging clearer --- crates/lanspread-client/src/lib.rs | 4 ++-- crates/lanspread-server/src/main.rs | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/crates/lanspread-client/src/lib.rs b/crates/lanspread-client/src/lib.rs index 452a378..e6650f5 100644 --- a/crates/lanspread-client/src/lib.rs +++ b/crates/lanspread-client/src/lib.rs @@ -97,10 +97,10 @@ pub async fn run( data.extend_from_slice(&bytes); } log::debug!("{} bytes received from server", data.len()); - log::trace!("server response (RAW): {}", String::from_utf8_lossy(&data)); + log::trace!("msg: (raw): {}", String::from_utf8_lossy(&data)); let response = Response::decode(data.freeze()); - log::trace!("server response (DECODED): {response:?}"); + log::trace!("msg: {response:?}"); match response { Response::Games(games) => { diff --git a/crates/lanspread-server/src/main.rs b/crates/lanspread-server/src/main.rs index b473459..ef06c6e 100644 --- a/crates/lanspread-server/src/main.rs +++ b/crates/lanspread-server/src/main.rs @@ -71,17 +71,13 @@ impl Server { // handle streams while let Ok(Some(data)) = rx.receive().await { tracing::trace!( - "{} client request (raw): {}", + "{} msg: (raw): {}", conn_ctx.remote_addr, String::from_utf8_lossy(&data) ); let request = Request::decode(data); - tracing::debug!( - "{} client request (decoded): {:?}", - conn_ctx.remote_addr, - request - ); + tracing::debug!("{} msg: {:?}", conn_ctx.remote_addr, request); let response = conn_ctx.server_ctx.handler.handle_request(request).await; tracing::trace!(