Browse Source

Merge pull request #85 from kinsi55/master

Added --no-logs launch argument
pull/86/head
nike4613 2 years ago
committed by GitHub
parent
commit
3fa908a557
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions
  1. +6
    -0
      IPA.Loader/Config/SelfConfig.cs
  2. +8
    -5
      IPA.Loader/Logging/StandardLogger.cs

+ 6
- 0
IPA.Loader/Config/SelfConfig.cs View File

@ -53,6 +53,9 @@ namespace IPA.Config
case "--no-yeet": case "--no-yeet":
CommandLineValues.YeetMods = false; CommandLineValues.YeetMods = false;
break; break;
case "--no-logs":
CommandLineValues.WriteLogs = true;
break;
case "--condense-logs": case "--condense-logs":
CommandLineValues.Debug.CondenseModLogs = true; CommandLineValues.Debug.CondenseModLogs = true;
break; break;
@ -174,6 +177,9 @@ namespace IPA.Config
public static bool YeetMods_ => (Instance?.YeetMods ?? true) public static bool YeetMods_ => (Instance?.YeetMods ?? true)
&& CommandLineValues.YeetMods; && CommandLineValues.YeetMods;
[JsonIgnore]
public bool WriteLogs { get; set; } = true;
// LINE: ignore // LINE: ignore
[NonNullable, UseConverter(typeof(CollectionConverter<string, HashSet<string?>>))] [NonNullable, UseConverter(typeof(CollectionConverter<string, HashSet<string?>>))]
public virtual HashSet<string> GameAssemblies { get; set; } = new HashSet<string> public virtual HashSet<string> GameAssemblies { get; set; } = new HashSet<string>


+ 8
- 5
IPA.Loader/Logging/StandardLogger.cs View File

@ -25,10 +25,7 @@ namespace IPA.Logging
/// </remarks> /// </remarks>
public class StandardLogger : Logger public class StandardLogger : Logger
{ {
private static readonly List<LogPrinter> defaultPrinters = new()
{
new GlobalLogFilePrinter()
};
private static readonly List<LogPrinter> defaultPrinters = new();
static StandardLogger() static StandardLogger()
{ {
@ -115,6 +112,7 @@ namespace IPA.Logging
private readonly Dictionary<string, StandardLogger> children = new(); private readonly Dictionary<string, StandardLogger> children = new();
private static bool addedFilePrinter = false;
/// <summary> /// <summary>
/// Configures internal debug settings based on the config passed in. /// Configures internal debug settings based on the config passed in.
/// </summary> /// </summary>
@ -124,6 +122,11 @@ namespace IPA.Logging
PrintFilter = SelfConfig.Debug_.ShowDebug_ ? LogLevel.All : LogLevel.InfoUp; PrintFilter = SelfConfig.Debug_.ShowDebug_ ? LogLevel.All : LogLevel.InfoUp;
showTrace = SelfConfig.Debug_.ShowTrace_; showTrace = SelfConfig.Debug_.ShowTrace_;
syncLogging = SelfConfig.Debug_.SyncLogging_; syncLogging = SelfConfig.Debug_.SyncLogging_;
if (SelfConfig.CommandLineValues.WriteLogs && !addedFilePrinter)
{
addedFilePrinter = true;
AddDefaultPrinter(new GlobalLogFilePrinter());
}
} }
private StandardLogger(StandardLogger parent, string subName) private StandardLogger(StandardLogger parent, string subName)
@ -457,4 +460,4 @@ namespace IPA.Logging
_ => throw new InvalidOperationException() _ => throw new InvalidOperationException()
}; };
} }
}
}

Loading…
Cancel
Save