PreloaderConsoleListener.cs 763 B

1234567891011121314151617181920212223242526
  1. using System.Collections.Generic;
  2. using BepInEx.Configuration;
  3. using BepInEx.Logging;
  4. namespace BepInEx.Preloader
  5. {
  6. public class PreloaderConsoleListener : ILogListener
  7. {
  8. public static List<LogEventArgs> LogEvents { get; } = new List<LogEventArgs>();
  9. public void LogEvent(object sender, LogEventArgs eventArgs)
  10. {
  11. if ((eventArgs.Level & ConfigConsoleDisplayedLevel.Value) == 0)
  12. return;
  13. LogEvents.Add(eventArgs);
  14. }
  15. private static readonly ConfigEntry<LogLevel> ConfigConsoleDisplayedLevel = ConfigFile.CoreConfig.Bind(
  16. "Logging.Console","LogLevels",
  17. LogLevel.Fatal | LogLevel.Error | LogLevel.Message | LogLevel.Info | LogLevel.Warning,
  18. "Which log levels to show in the console output.");
  19. public void Dispose() { }
  20. }
  21. }