ILogger.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // These values are designed to match the ASP.NET Log Levels since that's the pattern we're emulating here.
  4. /** Indicates the severity of a log message.
  5. *
  6. * Log Levels are ordered in increasing severity. So `Debug` is more severe than `Trace`, etc.
  7. */
  8. export enum LogLevel {
  9. /** Log level for very low severity diagnostic messages. */
  10. Trace = 0,
  11. /** Log level for low severity diagnostic messages. */
  12. Debug = 1,
  13. /** Log level for informational diagnostic messages. */
  14. Information = 2,
  15. /** Log level for diagnostic messages that indicate a non-fatal problem. */
  16. Warning = 3,
  17. /** Log level for diagnostic messages that indicate a failure in the current operation. */
  18. Error = 4,
  19. /** Log level for diagnostic messages that indicate a failure that will terminate the entire application. */
  20. Critical = 5,
  21. /** The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted. */
  22. None = 6,
  23. }
  24. /** An abstraction that provides a sink for diagnostic messages. */
  25. export interface ILogger {
  26. /** Called by the framework to emit a diagnostic message.
  27. *
  28. * @param {LogLevel} logLevel The severity level of the message.
  29. * @param {string} message The message.
  30. */
  31. log(logLevel: LogLevel, message: string): void;
  32. }