Skip to content

Commit 0cd70b0

Browse files
authored
use tracing for logs (#451)
1 parent 4b6a581 commit 0cd70b0

File tree

11 files changed

+19
-13
lines changed

11 files changed

+19
-13
lines changed

actix-codec/CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Changes
22

33
## Unreleased - 2022-xx-xx
4+
- Logs emitted now use the `tracing` crate with `log` compatibility. [#451]
45
- Minimum supported Rust version (MSRV) is now 1.49.
56

7+
[#451]: https://github.com/actix/actix-net/pull/451
8+
69

710
## 0.5.0 - 2022-02-15
811
- Updated `tokio-util` dependency to `0.7.0`. [#446]

actix-codec/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ bitflags = "1.2"
2121
bytes = "1"
2222
futures-core = { version = "0.3.7", default-features = false }
2323
futures-sink = { version = "0.3.7", default-features = false }
24-
log = "0.4"
2524
memchr = "2.3"
2625
pin-project-lite = "0.2"
2726
tokio = "1.13.1"
2827
tokio-util = { version = "0.7", features = ["codec", "io"] }
28+
tracing = { version = "0.1.30", default-features = false, features = ["log"] }
2929

3030
[dev-dependencies]
3131
criterion = { version = "0.3", features = ["html_reports"] }

actix-codec/src/framed.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@ impl<T, U> Framed<T, U> {
197197
}
198198
}
199199

200-
log::trace!("attempting to decode a frame");
200+
tracing::trace!("attempting to decode a frame");
201201

202202
match this.codec.decode(this.read_buf) {
203203
Ok(Some(frame)) => {
204-
log::trace!("frame decoded from buffer");
204+
tracing::trace!("frame decoded from buffer");
205205
return Poll::Ready(Some(Ok(frame)));
206206
}
207207
Err(err) => return Poll::Ready(Some(Err(err))),
@@ -242,10 +242,10 @@ impl<T, U> Framed<T, U> {
242242
U: Encoder<I>,
243243
{
244244
let mut this = self.as_mut().project();
245-
log::trace!("flushing framed transport");
245+
tracing::trace!("flushing framed transport");
246246

247247
while !this.write_buf.is_empty() {
248-
log::trace!("writing; remaining={}", this.write_buf.len());
248+
tracing::trace!("writing; remaining={}", this.write_buf.len());
249249

250250
let n = ready!(this.io.as_mut().poll_write(cx, this.write_buf))?;
251251

@@ -264,7 +264,7 @@ impl<T, U> Framed<T, U> {
264264
// Try flushing the underlying IO
265265
ready!(this.io.poll_flush(cx))?;
266266

267-
log::trace!("framed transport flushed");
267+
tracing::trace!("framed transport flushed");
268268
Poll::Ready(Ok(()))
269269
}
270270

actix-tls/CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changes
22

33
## Unreleased - 2022-xx-xx
4+
- Logs emitted now use the `tracing` crate with `log` compatibility. [#451]
5+
6+
[#451]: https://github.com/actix/actix-net/pull/451
47

58

69
## 3.0.3 - 2022-02-15

actix-tls/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ actix-service = "2.0.0"
4848
actix-utils = "3.0.0"
4949

5050
futures-core = { version = "0.3.7", default-features = false, features = ["alloc"] }
51-
log = "0.4"
5251
pin-project-lite = "0.2.7"
5352
tokio-util = "0.7"
53+
tracing = { version = "0.1.30", default-features = false, features = ["log"] }
5454

5555
# uri
5656
http = { version = "0.2.3", optional = true }

actix-tls/examples/accept-rustls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ use actix_server::Server;
3434
use actix_service::ServiceFactoryExt as _;
3535
use actix_tls::accept::rustls::{Acceptor as RustlsAcceptor, TlsStream};
3636
use futures_util::future::ok;
37-
use log::info;
3837
use rustls::{server::ServerConfig, Certificate, PrivateKey};
3938
use rustls_pemfile::{certs, rsa_private_keys};
39+
use tracing::info;
4040

4141
#[actix_rt::main]
4242
async fn main() -> io::Result<()> {

actix-tls/src/connect/native_tls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ use actix_rt::net::ActixStream;
88
use actix_service::{Service, ServiceFactory};
99
use actix_utils::future::{ok, Ready};
1010
use futures_core::future::LocalBoxFuture;
11-
use log::trace;
1211
use tokio_native_tls::{
1312
native_tls::TlsConnector as NativeTlsConnector, TlsConnector as AsyncNativeTlsConnector,
1413
TlsStream as AsyncTlsStream,
1514
};
15+
use tracing::trace;
1616

1717
use crate::connect::{Connection, Host};
1818

actix-tls/src/connect/openssl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use actix_rt::net::ActixStream;
1313
use actix_service::{Service, ServiceFactory};
1414
use actix_utils::future::{ok, Ready};
1515
use futures_core::ready;
16-
use log::trace;
1716
use openssl::ssl::SslConnector;
1817
use tokio_openssl::SslStream as AsyncSslStream;
18+
use tracing::trace;
1919

2020
use crate::connect::{Connection, Host};
2121

actix-tls/src/connect/resolver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use actix_rt::task::{spawn_blocking, JoinHandle};
1212
use actix_service::{Service, ServiceFactory};
1313
use actix_utils::future::{ok, Ready};
1414
use futures_core::{future::LocalBoxFuture, ready};
15-
use log::trace;
15+
use tracing::trace;
1616

1717
use super::{ConnectError, ConnectInfo, Host, Resolve};
1818

actix-tls/src/connect/rustls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ use actix_rt::net::ActixStream;
1515
use actix_service::{Service, ServiceFactory};
1616
use actix_utils::future::{ok, Ready};
1717
use futures_core::ready;
18-
use log::trace;
1918
use tokio_rustls::rustls::{client::ServerName, OwnedTrustAnchor, RootCertStore};
2019
use tokio_rustls::{client::TlsStream as AsyncTlsStream, rustls::ClientConfig};
2120
use tokio_rustls::{Connect as RustlsConnect, TlsConnector as RustlsTlsConnector};
21+
use tracing::trace;
2222
use webpki_roots::TLS_SERVER_ROOTS;
2323

2424
use crate::connect::{Connection, Host};

0 commit comments

Comments
 (0)