From 1e07acc28eaae6a48ad1dfc747ae24fa5d510afb Mon Sep 17 00:00:00 2001 From: Bar Shaul <88437685+barshaul@users.noreply.github.com> Date: Wed, 3 Jul 2024 17:52:29 +0300 Subject: [PATCH] Improved client logs (#167) --- redis/src/aio/connection.rs | 3 +++ redis/src/cluster_async/mod.rs | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/redis/src/aio/connection.rs b/redis/src/aio/connection.rs index 0b51e675d..3169c62bd 100644 --- a/redis/src/aio/connection.rs +++ b/redis/src/aio/connection.rs @@ -28,6 +28,7 @@ use std::net::{IpAddr, SocketAddr}; use std::pin::Pin; #[cfg(any(feature = "tokio-comp", feature = "async-std-comp"))] use tokio_util::codec::Decoder; +use tracing::info; /// Represents a stateful redis TCP connection. #[deprecated(note = "aio::Connection is deprecated. Use aio::MultiplexedConnection instead.")] @@ -451,6 +452,7 @@ pub(crate) async fn connect_simple( ConnectionAddr::Tcp(ref host, port) => { let socket_addrs = get_socket_addrs(host, port).await?; select_ok(socket_addrs.map(|socket_addr| { + info!("IP of node {:?} is {:?}", host, socket_addr.ip()); Box::pin(async move { Ok::<_, RedisError>(( ::connect_tcp(socket_addr).await?, @@ -477,6 +479,7 @@ pub(crate) async fn connect_simple( } let socket_addrs = get_socket_addrs(host, port).await?; select_ok(socket_addrs.map(|socket_addr| { + info!("IP of node {:?} is {:?}", host, socket_addr.ip()); Box::pin(async move { Ok::<_, RedisError>(( ::connect_tcp_tls(host, socket_addr, insecure, tls_params).await?, diff --git a/redis/src/cluster_async/mod.rs b/redis/src/cluster_async/mod.rs index b766d5949..98c735269 100644 --- a/redis/src/cluster_async/mod.rs +++ b/redis/src/cluster_async/mod.rs @@ -794,7 +794,8 @@ impl Future for Request { .into(); } }; - trace!("Request error `{}` on node `{:?}", err, address); + + warn!("Received request error {} on node {:?}.", err, address); match err.retry_method() { crate::types::RetryMethod::AskRedirect => {