You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

LLamaLogLevel.cs 1.4 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using Microsoft.Extensions.Logging;
  3. namespace LLama.Native
  4. {
  5. /// <summary>
  6. /// Severity level of a log message
  7. /// </summary>
  8. public enum LLamaLogLevel
  9. {
  10. /// <summary>
  11. /// Logs that highlight when the current flow of execution is stopped due to a failure.
  12. /// </summary>
  13. Error = 2,
  14. /// <summary>
  15. /// Logs that highlight an abnormal or unexpected event in the application flow, but do not otherwise cause the application execution to stop.
  16. /// </summary>
  17. Warning = 3,
  18. /// <summary>
  19. /// Logs that track the general flow of the application.
  20. /// </summary>
  21. Info = 4,
  22. /// <summary>
  23. /// Logs that are used for interactive investigation during development.
  24. /// </summary>
  25. Debug = 5,
  26. }
  27. internal static class LLamaLogLevelExtensions
  28. {
  29. public static LogLevel ToLogLevel(this LLamaLogLevel llama)
  30. {
  31. return (llama) switch
  32. {
  33. LLamaLogLevel.Error => LogLevel.Error,
  34. LLamaLogLevel.Warning => LogLevel.Warning,
  35. LLamaLogLevel.Info => LogLevel.Information,
  36. LLamaLogLevel.Debug => LogLevel.Debug,
  37. _ => throw new ArgumentOutOfRangeException(nameof(llama), llama, null)
  38. };
  39. }
  40. }
  41. }