aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-01-12 21:51:37 +0000
committermat <git@matdoes.dev>2025-01-12 21:51:37 +0000
commit093c99a0715b242895e553341711065e82cb69f6 (patch)
tree3813308c07b6d2e2cc5698d8d30c199474f59754
parent608ccb8e54454460a1b41a456f99b16d70fb5913 (diff)
downloadazalea-drasl-093c99a0715b242895e553341711065e82cb69f6.tar.xz
add AZALEA_DO_NOT_CUT_OFF_PACKET_LOGS env variable
-rwxr-xr-xazalea-protocol/src/read.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/azalea-protocol/src/read.rs b/azalea-protocol/src/read.rs
index 54d29e61..50764c88 100755
--- a/azalea-protocol/src/read.rs
+++ b/azalea-protocol/src/read.rs
@@ -1,6 +1,8 @@
//! Read packets from a stream.
use std::backtrace::Backtrace;
+use std::env;
+use std::sync::LazyLock;
use std::{
fmt::Debug,
io::{Cursor, Read},
@@ -367,10 +369,14 @@ where
}
if tracing::enabled!(tracing::Level::TRACE) {
- const DO_NOT_CUT_OFF_PACKET_LOGS: bool = false;
+ static DO_NOT_CUT_OFF_PACKET_LOGS: LazyLock<bool> = LazyLock::new(|| {
+ env::var("AZALEA_DO_NOT_CUT_OFF_PACKET_LOGS")
+ .map(|s| s == "1" || s == "true")
+ .unwrap_or(false)
+ });
let buf_string: String = {
- if !DO_NOT_CUT_OFF_PACKET_LOGS && buf.len() > 500 {
+ if !*DO_NOT_CUT_OFF_PACKET_LOGS && buf.len() > 500 {
let cut_off_buf = &buf[..500];
format!("{cut_off_buf:?}...")
} else {