From bcd65857df7742a3897d151aa97f1427da54a16d Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Fri, 22 Jul 2022 20:51:11 +0100 Subject: [PATCH] standardize logs --- actix-server/examples/file-reader.rs | 2 +- actix-server/examples/tcp-echo.rs | 4 ++-- actix-server/src/server.rs | 6 +++--- actix-server/src/service.rs | 2 +- actix-server/tests/server.rs | 4 ++-- actix-tls/src/connect/native_tls.rs | 6 +++--- actix-tls/src/connect/openssl.rs | 7 ++++--- actix-tls/src/connect/rustls.rs | 4 ++-- actix-tls/src/connect/tcp.rs | 4 ++-- 9 files changed, 20 insertions(+), 19 deletions(-) diff --git a/actix-server/examples/file-reader.rs b/actix-server/examples/file-reader.rs index e7ff42f5..f84cb510 100644 --- a/actix-server/examples/file-reader.rs +++ b/actix-server/examples/file-reader.rs @@ -74,7 +74,7 @@ async fn run() -> io::Result<()> { // close connection after file has been copied to TCP stream Ok(()) }) - .map_err(|err| tracing::error!("service Error: {:?}", err)) + .map_err(|err| tracing::error!("service error: {:?}", err)) })? .workers(2) .run() diff --git a/actix-server/examples/tcp-echo.rs b/actix-server/examples/tcp-echo.rs index d67d4198..eda24f83 100644 --- a/actix-server/examples/tcp-echo.rs +++ b/actix-server/examples/tcp-echo.rs @@ -64,7 +64,7 @@ async fn run() -> io::Result<()> { // stream error; bail from loop with error Err(err) => { - tracing::error!("stream Error: {:?}", err); + tracing::error!("stream error: {:?}", err); return Err(()); } } @@ -74,7 +74,7 @@ async fn run() -> io::Result<()> { Ok((buf.freeze(), size)) } }) - .map_err(|err| tracing::error!("service Error: {:?}", err)) + .map_err(|err| tracing::error!("service error: {:?}", err)) .and_then(move |(_, size)| { let num = num2.load(Ordering::SeqCst); tracing::info!("[{}] total bytes read: {}", num, size); diff --git a/actix-server/src/server.rs b/actix-server/src/server.rs index 7abe1d2c..a7bd5b53 100644 --- a/actix-server/src/server.rs +++ b/actix-server/src/server.rs @@ -193,9 +193,9 @@ impl ServerInner { let is_tokio = tokio::runtime::Handle::try_current().is_ok(); match (is_actix, is_tokio) { - (true, _) => info!("actix runtime found; starting in actix runtime"), - (_, true) => info!("tokio runtime found; starting in existing tokio runtime"), - (_, false) => panic!("actix or tokio runtime not found; halting"), + (true, _) => info!("Actix runtime found; starting in Actix runtime"), + (_, true) => info!("Tokio runtime found; starting in existing Tokio runtime"), + (_, false) => panic!("Actix or Tokio runtime not found; halting"), } for (_, name, lst) in &builder.sockets { diff --git a/actix-server/src/service.rs b/actix-server/src/service.rs index 69a14484..f07ec3e5 100644 --- a/actix-server/src/service.rs +++ b/actix-server/src/service.rs @@ -78,7 +78,7 @@ where Ok(()) } Err(err) => { - error!("can not convert to an async tcp stream: {}", err); + error!("can not convert to an async TCP stream: {}", err); Err(()) } }) diff --git a/actix-server/tests/server.rs b/actix-server/tests/server.rs index ec3155c9..dc0c57ca 100644 --- a/actix-server/tests/server.rs +++ b/actix-server/tests/server.rs @@ -186,9 +186,9 @@ fn test_start() { #[actix_rt::test] async fn test_max_concurrent_connections() { // Note: - // A tcp listener would accept connects based on it's backlog setting. + // A TCP listener would accept connects based on it's backlog setting. // - // The limit test on the other hand is only for concurrent tcp stream limiting a work + // The limit test on the other hand is only for concurrent TCP stream limiting a work // thread accept. use tokio::io::AsyncWriteExt; diff --git a/actix-tls/src/connect/native_tls.rs b/actix-tls/src/connect/native_tls.rs index 5366856e..37b9ffa4 100644 --- a/actix-tls/src/connect/native_tls.rs +++ b/actix-tls/src/connect/native_tls.rs @@ -74,16 +74,16 @@ where let connector = self.connector.clone(); Box::pin(async move { - trace!("SSL handshake start for: {:?}", stream.hostname()); + trace!("TLS handshake start for: {:?}", stream.hostname()); connector .connect(stream.hostname(), io) .await .map(|res| { - trace!("SSL handshake success: {:?}", stream.hostname()); + trace!("TLS handshake success: {:?}", stream.hostname()); stream.replace_io(res).1 }) .map_err(|e| { - trace!("SSL handshake error: {:?}", e); + trace!("TLS handshake error: {:?}", e); io::Error::new(io::ErrorKind::Other, format!("{}", e)) }) }) diff --git a/actix-tls/src/connect/openssl.rs b/actix-tls/src/connect/openssl.rs index af47bf6b..caff4f0f 100644 --- a/actix-tls/src/connect/openssl.rs +++ b/actix-tls/src/connect/openssl.rs @@ -97,7 +97,8 @@ where actix_service::always_ready!(); fn call(&self, stream: Connection) -> Self::Future { - trace!("SSL handshake start for: {:?}", stream.hostname()); + trace!("TLS handshake start for: {:?}", stream.hostname()); + let (io, stream) = stream.replace_io(()); let host = stream.hostname(); @@ -137,11 +138,11 @@ where match ready!(Pin::new(this.io.as_mut().unwrap()).poll_connect(cx)) { Ok(_) => { let stream = this.stream.take().unwrap(); - trace!("SSL handshake success: {:?}", stream.hostname()); + trace!("TLS handshake success: {:?}", stream.hostname()); Poll::Ready(Ok(stream.replace_io(this.io.take().unwrap()).1)) } Err(err) => { - trace!("SSL handshake error: {:?}", err); + trace!("TLS handshake error: {:?}", err); Poll::Ready(Err(io::Error::new( io::ErrorKind::Other, format!("{}", err), diff --git a/actix-tls/src/connect/rustls.rs b/actix-tls/src/connect/rustls.rs index f0e5a54a..0a44479a 100644 --- a/actix-tls/src/connect/rustls.rs +++ b/actix-tls/src/connect/rustls.rs @@ -101,7 +101,7 @@ where actix_service::always_ready!(); fn call(&self, connection: Connection) -> Self::Future { - trace!("SSL handshake start for: {:?}", connection.hostname()); + trace!("TLS handshake start for: {:?}", connection.hostname()); let (stream, connection) = connection.replace_io(()); match ServerName::try_from(connection.hostname()) { @@ -140,7 +140,7 @@ where Self::Future { connect, connection } => { let stream = ready!(Pin::new(connect).poll(cx))?; let connection = connection.take().unwrap(); - trace!("SSL handshake success: {:?}", connection.hostname()); + trace!("TLS handshake success: {:?}", connection.hostname()); Poll::Ready(Ok(connection.replace_io(stream).1)) } } diff --git a/actix-tls/src/connect/tcp.rs b/actix-tls/src/connect/tcp.rs index b102620c..b247e7f1 100644 --- a/actix-tls/src/connect/tcp.rs +++ b/actix-tls/src/connect/tcp.rs @@ -114,8 +114,8 @@ impl TcpConnectorFut { stream: ReusableBoxFuture::new(connect(addr, local_addr)), }, - // when resolver returns multiple socket addr for request they would be popped from - // front end of queue and returns with the first successful tcp connection. + // When resolver returns multiple socket addr for request they would be popped from + // front end of queue and returns with the first successful TCP connection. ConnectAddrs::Multi(mut addrs) => { let addr = addrs.pop_front().unwrap();