1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

fix bytes of packets not being logged in tracing

This commit is contained in:
mat 2023-12-16 13:28:22 -06:00
parent dc26558415
commit 9260892d44
3 changed files with 4 additions and 3 deletions

1
Cargo.lock generated
View file

@ -444,6 +444,7 @@ dependencies = [
"futures",
"futures-lite 2.1.0",
"futures-util",
"log",
"once_cell",
"serde",
"serde_json",

View file

@ -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 = []

View file

@ -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))
}