diff --git a/IPA.Loader/Config/SelfConfig.cs b/IPA.Loader/Config/SelfConfig.cs index 451627fb..433ac088 100644 --- a/IPA.Loader/Config/SelfConfig.cs +++ b/IPA.Loader/Config/SelfConfig.cs @@ -53,6 +53,9 @@ namespace IPA.Config case "--no-yeet": CommandLineValues.YeetMods = false; break; + case "--no-logs": + CommandLineValues.WriteLogs = true; + break; case "--condense-logs": CommandLineValues.Debug.CondenseModLogs = true; break; @@ -174,6 +177,9 @@ namespace IPA.Config public static bool YeetMods_ => (Instance?.YeetMods ?? true) && CommandLineValues.YeetMods; + [JsonIgnore] + public bool WriteLogs { get; set; } = true; + // LINE: ignore [NonNullable, UseConverter(typeof(CollectionConverter>))] public virtual HashSet GameAssemblies { get; set; } = new HashSet diff --git a/IPA.Loader/Logging/StandardLogger.cs b/IPA.Loader/Logging/StandardLogger.cs index 72a5b3c3..50bb727b 100644 --- a/IPA.Loader/Logging/StandardLogger.cs +++ b/IPA.Loader/Logging/StandardLogger.cs @@ -25,10 +25,7 @@ namespace IPA.Logging /// public class StandardLogger : Logger { - private static readonly List defaultPrinters = new() - { - new GlobalLogFilePrinter() - }; + private static readonly List defaultPrinters = new(); static StandardLogger() { @@ -115,6 +112,7 @@ namespace IPA.Logging private readonly Dictionary children = new(); + private static bool addedFilePrinter = false; /// /// Configures internal debug settings based on the config passed in. /// @@ -124,6 +122,10 @@ namespace IPA.Logging PrintFilter = SelfConfig.Debug_.ShowDebug_ ? LogLevel.All : LogLevel.InfoUp; showTrace = SelfConfig.Debug_.ShowTrace_; syncLogging = SelfConfig.Debug_.SyncLogging_; + if(SelfConfig.CommandLineValues.WriteLogs && !addedFilePrinter) { + addedFilePrinter = true; + AddDefaultPrinter(new GZFilePrinter()); + } } private StandardLogger(StandardLogger parent, string subName)