1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-26 16:17:43 +02:00

use tracing for logs (#451)

This commit is contained in:
Rob Ede
2022-03-15 19:37:08 +00:00
committed by GitHub
parent 4b6a581ef3
commit 0cd70b0536
11 changed files with 19 additions and 13 deletions

View File

@ -1,8 +1,11 @@
# Changes
## Unreleased - 2022-xx-xx
- Logs emitted now use the `tracing` crate with `log` compatibility. [#451]
- Minimum supported Rust version (MSRV) is now 1.49.
[#451]: https://github.com/actix/actix-net/pull/451
## 0.5.0 - 2022-02-15
- Updated `tokio-util` dependency to `0.7.0`. [#446]

View File

@ -21,11 +21,11 @@ bitflags = "1.2"
bytes = "1"
futures-core = { version = "0.3.7", default-features = false }
futures-sink = { version = "0.3.7", default-features = false }
log = "0.4"
memchr = "2.3"
pin-project-lite = "0.2"
tokio = "1.13.1"
tokio-util = { version = "0.7", features = ["codec", "io"] }
tracing = { version = "0.1.30", default-features = false, features = ["log"] }
[dev-dependencies]
criterion = { version = "0.3", features = ["html_reports"] }

View File

@ -197,11 +197,11 @@ impl<T, U> Framed<T, U> {
}
}
log::trace!("attempting to decode a frame");
tracing::trace!("attempting to decode a frame");
match this.codec.decode(this.read_buf) {
Ok(Some(frame)) => {
log::trace!("frame decoded from buffer");
tracing::trace!("frame decoded from buffer");
return Poll::Ready(Some(Ok(frame)));
}
Err(err) => return Poll::Ready(Some(Err(err))),
@ -242,10 +242,10 @@ impl<T, U> Framed<T, U> {
U: Encoder<I>,
{
let mut this = self.as_mut().project();
log::trace!("flushing framed transport");
tracing::trace!("flushing framed transport");
while !this.write_buf.is_empty() {
log::trace!("writing; remaining={}", this.write_buf.len());
tracing::trace!("writing; remaining={}", this.write_buf.len());
let n = ready!(this.io.as_mut().poll_write(cx, this.write_buf))?;
@ -264,7 +264,7 @@ impl<T, U> Framed<T, U> {
// Try flushing the underlying IO
ready!(this.io.poll_flush(cx))?;
log::trace!("framed transport flushed");
tracing::trace!("framed transport flushed");
Poll::Ready(Ok(()))
}