From 9260892d44f2072be5c5be0c28ff37a6476ae25b Mon Sep 17 00:00:00 2001 From: mat Date: Sat, 16 Dec 2023 13:28:22 -0600 Subject: [PATCH] fix bytes of packets not being logged in tracing --- Cargo.lock | 1 + azalea-protocol/Cargo.toml | 1 + azalea-protocol/src/read.rs | 5 ++--- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c9476042..4903876d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -444,6 +444,7 @@ dependencies = [ "futures", "futures-lite 2.1.0", "futures-util", + "log", "once_cell", "serde", "serde_json", diff --git a/azalea-protocol/Cargo.toml b/azalea-protocol/Cargo.toml index 9cbc4859..e5ff3824 100644 --- a/azalea-protocol/Cargo.toml +++ b/azalea-protocol/Cargo.toml @@ -46,6 +46,7 @@ trust-dns-resolver = { version = "^0.23.2", default-features = false, features = "tokio-runtime", ] } uuid = "1.6.1" +log = "0.4.20" [features] connecting = [] diff --git a/azalea-protocol/src/read.rs b/azalea-protocol/src/read.rs index 6b730d3f..7c641c76 100755 --- a/azalea-protocol/src/read.rs +++ b/azalea-protocol/src/read.rs @@ -17,7 +17,6 @@ use std::{ use thiserror::Error; use tokio::io::AsyncRead; use tokio_util::codec::{BytesCodec, FramedRead}; -use tracing::if_log_enabled; #[derive(Error, Debug)] pub enum ReadPacketError { @@ -348,7 +347,7 @@ where .map_err(ReadPacketError::from)?; } - if_log_enabled!(tracing::Level::TRACE, { + if log::log_enabled!(log::Level::Trace) { let buf_string: String = { if buf.len() > 500 { let cut_off_buf = &buf[..500]; @@ -358,7 +357,7 @@ where } }; tracing::trace!("Reading packet with bytes: {buf_string}"); - }); + }; Ok(Some(buf)) }