ILogger.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using System;
  2. namespace BestHTTP.Logger
  3. {
  4. /// <summary>
  5. /// Available logging levels.
  6. /// </summary>
  7. public enum Loglevels : int
  8. {
  9. /// <summary>
  10. /// All message will be logged.
  11. /// </summary>
  12. All,
  13. /// <summary>
  14. /// Only Informations and above will be logged.
  15. /// </summary>
  16. Information,
  17. /// <summary>
  18. /// Only Warnings and above will be logged.
  19. /// </summary>
  20. Warning,
  21. /// <summary>
  22. /// Only Errors and above will be logged.
  23. /// </summary>
  24. Error,
  25. /// <summary>
  26. /// Only Exceptions will be logged.
  27. /// </summary>
  28. Exception,
  29. /// <summary>
  30. /// No logging will occur.
  31. /// </summary>
  32. None
  33. }
  34. public interface ILogOutput : IDisposable
  35. {
  36. void Write(Loglevels level, string logEntry);
  37. }
  38. public interface ILogger
  39. {
  40. /// <summary>
  41. /// The minimum severity to log
  42. /// </summary>
  43. Loglevels Level { get; set; }
  44. ILogOutput Output { get; set; }
  45. void Verbose(string division, string msg, LoggingContext context1 = null, LoggingContext context2 = null, LoggingContext context3 = null);
  46. void Information(string division, string msg, LoggingContext context1 = null, LoggingContext context2 = null, LoggingContext context3 = null);
  47. void Warning(string division, string msg, LoggingContext context1 = null, LoggingContext context2 = null, LoggingContext context3 = null);
  48. void Error(string division, string msg, LoggingContext context1 = null, LoggingContext context2 = null, LoggingContext context3 = null);
  49. void Exception(string division, string msg, Exception ex, LoggingContext context1 = null, LoggingContext context2 = null, LoggingContext context3 = null);
  50. }
  51. }