ManualLogSource.cs 817 B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. namespace BepInEx.Logging
  3. {
  4. public class ManualLogSource : ILogSource
  5. {
  6. public string SourceName { get; }
  7. public event EventHandler<LogEventArgs> LogEvent;
  8. public ManualLogSource(string sourceName)
  9. {
  10. SourceName = sourceName;
  11. }
  12. public void Log(LogLevel level, object data)
  13. {
  14. LogEvent?.Invoke(this, new LogEventArgs(data, level, this));
  15. }
  16. public void LogFatal(object data) => Log(LogLevel.Fatal, data);
  17. public void LogError(object data) => Log(LogLevel.Error, data);
  18. public void LogWarning(object data) => Log(LogLevel.Warning, data);
  19. public void LogMessage(object data) => Log(LogLevel.Message, data);
  20. public void LogInfo(object data) => Log(LogLevel.Info, data);
  21. public void LogDebug(object data) => Log(LogLevel.Debug, data);
  22. public void Dispose() { }
  23. }
  24. }