mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
fix bytes of packets not being logged in tracing
This commit is contained in:
parent
dc26558415
commit
9260892d44
3 changed files with 4 additions and 3 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -444,6 +444,7 @@ dependencies = [
|
||||||
"futures",
|
"futures",
|
||||||
"futures-lite 2.1.0",
|
"futures-lite 2.1.0",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
|
"log",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
|
|
@ -46,6 +46,7 @@ trust-dns-resolver = { version = "^0.23.2", default-features = false, features =
|
||||||
"tokio-runtime",
|
"tokio-runtime",
|
||||||
] }
|
] }
|
||||||
uuid = "1.6.1"
|
uuid = "1.6.1"
|
||||||
|
log = "0.4.20"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
connecting = []
|
connecting = []
|
||||||
|
|
|
@ -17,7 +17,6 @@ use std::{
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use tokio::io::AsyncRead;
|
use tokio::io::AsyncRead;
|
||||||
use tokio_util::codec::{BytesCodec, FramedRead};
|
use tokio_util::codec::{BytesCodec, FramedRead};
|
||||||
use tracing::if_log_enabled;
|
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum ReadPacketError {
|
pub enum ReadPacketError {
|
||||||
|
@ -348,7 +347,7 @@ where
|
||||||
.map_err(ReadPacketError::from)?;
|
.map_err(ReadPacketError::from)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if_log_enabled!(tracing::Level::TRACE, {
|
if log::log_enabled!(log::Level::Trace) {
|
||||||
let buf_string: String = {
|
let buf_string: String = {
|
||||||
if buf.len() > 500 {
|
if buf.len() > 500 {
|
||||||
let cut_off_buf = &buf[..500];
|
let cut_off_buf = &buf[..500];
|
||||||
|
@ -358,7 +357,7 @@ where
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
tracing::trace!("Reading packet with bytes: {buf_string}");
|
tracing::trace!("Reading packet with bytes: {buf_string}");
|
||||||
});
|
};
|
||||||
|
|
||||||
Ok(Some(buf))
|
Ok(Some(buf))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue