Make preloader logger respect the log level

Rebase of 4b844b4
This commit is contained in:
Bepis committed 2020-11-05 23:53:52 +11:00
1 parent 5e66f77291
commit 3383c5c584
2 files changed
+5 -1

No files matched your search

+1 -1
View File
@@ -20,7 +20,7 @@ namespace BepInEx.Logging
public void Dispose() { }
private static readonly ConfigEntry<LogLevel> ConfigConsoleDisplayedLevel = ConfigFile.CoreConfig.Bind(
public static readonly ConfigEntry<LogLevel> ConfigConsoleDisplayedLevel = ConfigFile.CoreConfig.Bind(
"Logging.Console", "LogLevels",
LogLevel.Fatal | LogLevel.Error | LogLevel.Message | LogLevel.Info,
"Only displays the specified log levels in the console output.");
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
using BepInEx.Configuration;
using BepInEx.Logging;
namespace BepInEx.Preloader.Core.Logging
@@ -29,6 +30,9 @@ namespace BepInEx.Preloader.Core.Logging
public void LogEvent(object sender, LogEventArgs eventArgs)
{
if ((eventArgs.Level & ConsoleLogListener.ConfigConsoleDisplayedLevel.Value) == 0)
return;
LogEvents.Add(eventArgs);
ConsoleManager.SetConsoleColor(eventArgs.Level.GetConsoleColor());