Logger.cs 661 B

12345678910111213141516171819202122232425262728
  1. using BepInEx.Logging;
  2. namespace BepInEx
  3. {
  4. public static class Logger
  5. {
  6. public static BaseLogger CurrentLogger { get; set; }
  7. /// <summary>
  8. /// The listener event for an entry being logged.
  9. /// </summary>
  10. public static event BaseLogger.EntryLoggedEventHandler EntryLogged;
  11. public static void Log(LogLevel level, object entry)
  12. {
  13. EntryLogged?.Invoke(level, entry);
  14. CurrentLogger?.Log(level, entry);
  15. }
  16. public static void SetLogger(BaseLogger logger)
  17. {
  18. CurrentLogger?.Dispose();
  19. CurrentLogger = logger;
  20. }
  21. }
  22. }