From 093c99a0715b242895e553341711065e82cb69f6 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 12 Jan 2025 21:51:37 +0000 Subject: [PATCH] add AZALEA_DO_NOT_CUT_OFF_PACKET_LOGS env variable --- azalea-protocol/src/read.rs | 10 ++++++++-- 1 file 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 = 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 {