From 413c812ac8cdf8e61fd0860990c49d800da8e21f Mon Sep 17 00:00:00 2001 From: Gus Wynn Date: Sat, 26 Feb 2022 03:47:04 -0800 Subject: [PATCH] util: switch tokio-util from log to tracing (#4539) --- tokio-util/Cargo.toml | 4 ++-- tokio-util/src/codec/framed_impl.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tokio-util/Cargo.toml b/tokio-util/Cargo.toml index b4782d5d9a3..70b98837118 100644 --- a/tokio-util/Cargo.toml +++ b/tokio-util/Cargo.toml @@ -25,7 +25,7 @@ full = ["codec", "compat", "io-util", "time", "net", "rt"] net = ["tokio/net"] compat = ["futures-io",] -codec = [] +codec = ["tracing"] time = ["tokio/time","slab"] io = [] io-util = ["io", "tokio/rt", "tokio/io-util"] @@ -41,9 +41,9 @@ futures-core = "0.3.0" futures-sink = "0.3.0" futures-io = { version = "0.3.0", optional = true } futures-util = { version = "0.3.0", optional = true } -log = "0.4" pin-project-lite = "0.2.0" slab = { version = "0.4.4", optional = true } # Backs `DelayQueue` +tracing = { version = "0.1.25", optional = true } [dev-dependencies] tokio = { version = "1.0.0", path = "../tokio", features = ["full"] } diff --git a/tokio-util/src/codec/framed_impl.rs b/tokio-util/src/codec/framed_impl.rs index f932414e1e0..ce1a6db8739 100644 --- a/tokio-util/src/codec/framed_impl.rs +++ b/tokio-util/src/codec/framed_impl.rs @@ -7,12 +7,12 @@ use tokio::io::{AsyncRead, AsyncWrite}; use bytes::BytesMut; use futures_core::ready; use futures_sink::Sink; -use log::trace; use pin_project_lite::pin_project; use std::borrow::{Borrow, BorrowMut}; use std::io; use std::pin::Pin; use std::task::{Context, Poll}; +use tracing::trace; pin_project! { #[derive(Debug)] @@ -278,7 +278,7 @@ where while !pinned.state.borrow_mut().buffer.is_empty() { let WriteFrame { buffer } = pinned.state.borrow_mut(); - trace!("writing; remaining={}", buffer.len()); + trace!(remaining = buffer.len(), "writing;"); let n = ready!(poll_write_buf(pinned.inner.as_mut(), cx, buffer))?;