@@ -444,6 +444,16 @@ pub(crate) async fn get_socket_addrs(
444444 }
445445}
446446
447+ fn log_conn_creation < T > ( conn_type : & str , node : T , ip : Option < IpAddr > )
448+ where
449+ T : std:: fmt:: Debug ,
450+ {
451+ info ! (
452+ "Creating {conn_type} connection for node: {node:?}{}" ,
453+ ip. map( |ip| format!( ", IP: {:?}" , ip) ) . unwrap_or_default( )
454+ ) ;
455+ }
456+
447457pub ( crate ) async fn connect_simple < T : RedisRuntime > (
448458 connection_info : & ConnectionInfo ,
449459 _socket_addr : Option < SocketAddr > ,
@@ -458,7 +468,7 @@ pub(crate) async fn connect_simple<T: RedisRuntime>(
458468 }
459469 let socket_addrs = get_socket_addrs ( host, port) . await ?;
460470 select_ok ( socket_addrs. map ( |socket_addr| {
461- info ! ( "IP of node {:?} is {:?} ", host, socket_addr. ip( ) ) ;
471+ log_conn_creation ( "TCP ", host, Some ( socket_addr. ip ( ) ) ) ;
462472 Box :: pin ( async move {
463473 Ok :: < _ , RedisError > ( (
464474 <T >:: connect_tcp ( socket_addr) . await ?,
@@ -485,7 +495,7 @@ pub(crate) async fn connect_simple<T: RedisRuntime>(
485495 }
486496 let socket_addrs = get_socket_addrs ( host, port) . await ?;
487497 select_ok ( socket_addrs. map ( |socket_addr| {
488- info ! ( "IP of node {:?} is {:?} ", host, socket_addr. ip( ) ) ;
498+ log_conn_creation ( "TCP with TLS ", host, Some ( socket_addr. ip ( ) ) ) ;
489499 Box :: pin ( async move {
490500 Ok :: < _ , RedisError > ( (
491501 <T >:: connect_tcp_tls ( host, socket_addr, insecure, tls_params) . await ?,
@@ -506,7 +516,10 @@ pub(crate) async fn connect_simple<T: RedisRuntime>(
506516 }
507517
508518 #[ cfg( unix) ]
509- ConnectionAddr :: Unix ( ref path) => ( <T >:: connect_unix ( path) . await ?, None ) ,
519+ ConnectionAddr :: Unix ( ref path) => {
520+ log_conn_creation ( "UDS" , path, None ) ;
521+ ( <T >:: connect_unix ( path) . await ?, None )
522+ }
510523
511524 #[ cfg( not( unix) ) ]
512525 ConnectionAddr :: Unix ( _) => {
0 commit comments