LogEventArgs.cs 591 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. namespace BepInEx.Logging
  3. {
  4. public class LogEventArgs : EventArgs
  5. {
  6. public object Data { get; protected set; }
  7. public LogLevel Level { get; protected set; }
  8. public ILogSource Source { get; protected set; }
  9. public LogEventArgs(object data, LogLevel level, ILogSource source)
  10. {
  11. Data = data;
  12. Level = level;
  13. Source = source;
  14. }
  15. public override string ToString()
  16. {
  17. return $"[{Level,-7}:{Source.SourceName,10}] {Data}";
  18. }
  19. public string ToStringLine()
  20. {
  21. return $"[{Level,-7}:{Source.SourceName,10}] {Data}{Environment.NewLine}";
  22. }
  23. }
  24. }