Skip to content

Commit

Permalink
codec: make tracing feature optional for codecs (#6434)
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Reidel <[email protected]>
  • Loading branch information
Gelbpunkt authored Mar 30, 2024
1 parent 1fcb77d commit d298049
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tokio-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ full = ["codec", "compat", "io-util", "time", "net", "rt"]

net = ["tokio/net"]
compat = ["futures-io",]
codec = ["tracing"]
codec = []
time = ["tokio/time","slab"]
io = []
io-util = ["io", "tokio/rt", "tokio/io-util"]
Expand Down
1 change: 0 additions & 1 deletion tokio-util/src/codec/framed_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use std::borrow::{Borrow, BorrowMut};
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
use tracing::trace;

pin_project! {
#[derive(Debug)]
Expand Down
3 changes: 3 additions & 0 deletions tokio-util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ mod cfg;
mod loom;

cfg_codec! {
#[macro_use]
mod tracing;

pub mod codec;
}

Expand Down
6 changes: 6 additions & 0 deletions tokio-util/src/tracing.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
macro_rules! trace {
($($arg:tt)*) => {
#[cfg(feature = "tracing")]
tracing::trace!($($arg)*);
};
}

0 comments on commit d298049

Please sign in to comment.