From ea42dd8392b6938c86c39d333b83ebdd29d65f4f Mon Sep 17 00:00:00 2001 From: 1A3 Date: Wed, 17 Jan 2024 16:22:08 +0000 Subject: [PATCH] Config option to disable logging to disk --- src/Config/ConfigManager.cs | 5 +++++ src/UI/Panels/LogPanel.cs | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Config/ConfigManager.cs b/src/Config/ConfigManager.cs index f04c5dd5..61d1f553 100644 --- a/src/Config/ConfigManager.cs +++ b/src/Config/ConfigManager.cs @@ -27,6 +27,7 @@ public static class ConfigManager public static ConfigElement UI_MouseInspect_Keybind; public static ConfigElement CSConsole_Assembly_Blacklist; public static ConfigElement Reflection_Signature_Blacklist; + public static ConfigElement Save_Logs; // internal configs internal static InternalConfigHandler InternalHandler { get; private set; } @@ -140,6 +141,10 @@ private static void CreateConfigElements() "Seperate signatures with a semicolon ';'.\r\n" + "For example, to blacklist Camera.main, you would add 'UnityEngine.Camera.main;'", ""); + + Save_Logs = new("Save Logs To Disk", + "Should the log files be saved to disk?", + false); } } } diff --git a/src/UI/Panels/LogPanel.cs b/src/UI/Panels/LogPanel.cs index 7a010b8a..9c3625a3 100644 --- a/src/UI/Panels/LogPanel.cs +++ b/src/UI/Panels/LogPanel.cs @@ -73,7 +73,8 @@ private void SetupIO() File.Delete(files[i]); } - File.WriteAllLines(CurrentStreamPath, Logs.Select(it => it.message).ToArray()); + if (ConfigManager.Save_Logs.Value) + File.WriteAllLines(CurrentStreamPath, Logs.Select(it => it.message).ToArray()); } // Logging @@ -82,7 +83,7 @@ public static void Log(string message, LogType type) { Logs.Add(new LogInfo(message, type)); - if (CurrentStreamPath != null) + if (CurrentStreamPath != null && ConfigManager.Save_Logs.Value) File.AppendAllText(CurrentStreamPath, '\n' + message); if (logScrollPool != null)