Browse Source

Added option to disable Debug console spam

refactor
Anairkoen Schno 6 years ago
parent
commit
b1ed1f13d3
2 changed files with 9 additions and 2 deletions
  1. +1
    -1
      IllusionInjector/Logging/Printers/ColoredConsolePrinter.cs
  2. +8
    -1
      IllusionInjector/Logging/StandardLogger.cs

+ 1
- 1
IllusionInjector/Logging/Printers/ColoredConsolePrinter.cs View File

@ -19,7 +19,7 @@ namespace IllusionInjector.Logging.Printers
public override void Print(LoggerBase.Level level, DateTime time, string logName, string message) public override void Print(LoggerBase.Level level, DateTime time, string logName, string message)
{ {
if (((byte)level & (byte)Filter) == 0) return;
if (((byte)level & (byte)StandardLogger.PrintFilter) == 0) return;
Console.ForegroundColor = color; Console.ForegroundColor = color;
foreach (var line in message.Split(new string[] { "\n", Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) foreach (var line in message.Split(new string[] { "\n", Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
Console.WriteLine(string.Format(LoggerBase.LogFormat, line, logName, time, level.ToString().ToUpper())); Console.WriteLine(string.Format(LoggerBase.LogFormat, line, logName, time, level.ToString().ToUpper()));


+ 8
- 1
IllusionInjector/Logging/StandardLogger.cs View File

@ -1,4 +1,5 @@
using IllusionInjector.Logging.Printers; using IllusionInjector.Logging.Printers;
using IllusionPlugin;
using IllusionPlugin.Logging; using IllusionPlugin.Logging;
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
@ -59,9 +60,15 @@ namespace IllusionInjector.Logging
private string logName; private string logName;
private static LogLevel showFilter = LogLevel.InfoUp; private static LogLevel showFilter = LogLevel.InfoUp;
public static LogLevel Filter { get => showFilter; set => showFilter = value; }
public static LogLevel PrintFilter { get => showFilter; set => showFilter = value; }
private List<LogPrinter> printers = new List<LogPrinter>(defaultPrinters); private List<LogPrinter> printers = new List<LogPrinter>(defaultPrinters);
static StandardLogger()
{
if (ModPrefs.GetBool("IPA", "PrintDebug", false, true))
showFilter = LogLevel.All;
}
internal StandardLogger(string name) internal StandardLogger(string name)
{ {
logName = name; logName = name;


Loading…
Cancel
Save