From 119148acf0b25de8af2f030c56d99cdfefcb4934 Mon Sep 17 00:00:00 2001
From: EliteMasterEric <ericmyllyoja@gmail.com>
Date: Wed, 18 Sep 2024 02:11:31 -0400
Subject: [PATCH] Define for enabling/disabling log trace

---
 project.hxp                             | 8 ++++++++
 source/funkin/util/logging/AnsiTrace.hx | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/project.hxp b/project.hxp
index 934cc1d2d..73a12538a 100644
--- a/project.hxp
+++ b/project.hxp
@@ -157,6 +157,13 @@ class Project extends HXProject {
 	 */
 	static final FEATURE_DEBUG_TRACY:FeatureFlag = "FEATURE_DEBUG_TRACY";
 
+	/**
+	 * `-DFEATURE_LOG_TRACE`
+	 * If this flag is enabled, the game will print debug traces to the console.
+	 * Disable to improve performance a bunch.
+	 */
+	static final FEATURE_LOG_TRACE:FeatureFlag = "FEATURE_LOG_TRACE";
+
 	/**
 	 * `-DFEATURE_DISCORD_RPC`
 	 * If this flag is enabled, the game will enable the Discord Remote Procedure Call library.
@@ -461,6 +468,7 @@ class Project extends HXProject {
 
 		// Should be true on debug builds or if GITHUB_BUILD is enabled.
 		FEATURE_DEBUG_FUNCTIONS.apply(this, isDebug() || GITHUB_BUILD.isEnabled(this));
+		FEATURE_LOG_TRACE.apply(this, isDebug());
 
 		// Should default to true on workspace builds and false on release builds.
 		REDIRECT_ASSETS_FOLDER.apply(this, isDebug() && isDesktop());
diff --git a/source/funkin/util/logging/AnsiTrace.hx b/source/funkin/util/logging/AnsiTrace.hx
index 322a66820..18c6d1d92 100644
--- a/source/funkin/util/logging/AnsiTrace.hx
+++ b/source/funkin/util/logging/AnsiTrace.hx
@@ -6,7 +6,7 @@ class AnsiTrace
   // but adds nice cute ANSI things
   public static function trace(v:Dynamic, ?info:haxe.PosInfos)
   {
-    #if TREMOVE
+    #if NO_FEATURE_LOG_TRACE
     return;
     #end
     var str = formatOutput(v, info);