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.

llama.common.llamadefaultlogger.md 3.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. # LLamaDefaultLogger
  2. Namespace: LLama.Common
  3. The default logger of LLamaSharp. On default it write to console. Use methods of `LLamaLogger.Default` to change the behavior.
  4. It's recommended to inherit `ILLamaLogger` to customize the behavior.
  5. ```csharp
  6. public sealed class LLamaDefaultLogger : ILLamaLogger
  7. ```
  8. Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [LLamaDefaultLogger](./llama.common.llamadefaultlogger.md)<br>
  9. Implements [ILLamaLogger](./llama.common.illamalogger.md)
  10. ## Properties
  11. ### **Default**
  12. Get the default logger instance
  13. ```csharp
  14. public static LLamaDefaultLogger Default { get; }
  15. ```
  16. #### Property Value
  17. [LLamaDefaultLogger](./llama.common.llamadefaultlogger.md)<br>
  18. ## Methods
  19. ### **EnableNative()**
  20. Enable logging output from llama.cpp
  21. ```csharp
  22. public LLamaDefaultLogger EnableNative()
  23. ```
  24. #### Returns
  25. [LLamaDefaultLogger](./llama.common.llamadefaultlogger.md)<br>
  26. ### **EnableConsole()**
  27. Enable writing log messages to console
  28. ```csharp
  29. public LLamaDefaultLogger EnableConsole()
  30. ```
  31. #### Returns
  32. [LLamaDefaultLogger](./llama.common.llamadefaultlogger.md)<br>
  33. ### **DisableConsole()**
  34. Disable writing messages to console
  35. ```csharp
  36. public LLamaDefaultLogger DisableConsole()
  37. ```
  38. #### Returns
  39. [LLamaDefaultLogger](./llama.common.llamadefaultlogger.md)<br>
  40. ### **EnableFile(String, FileMode)**
  41. Enable writing log messages to file
  42. ```csharp
  43. public LLamaDefaultLogger EnableFile(string filename, FileMode mode)
  44. ```
  45. #### Parameters
  46. `filename` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  47. `mode` [FileMode](https://docs.microsoft.com/en-us/dotnet/api/system.io.filemode)<br>
  48. #### Returns
  49. [LLamaDefaultLogger](./llama.common.llamadefaultlogger.md)<br>
  50. ### **DisableFile(String)**
  51. #### Caution
  52. Use DisableFile method without 'filename' parameter
  53. ---
  54. Disable writing log messages to file
  55. ```csharp
  56. public LLamaDefaultLogger DisableFile(string filename)
  57. ```
  58. #### Parameters
  59. `filename` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  60. unused!
  61. #### Returns
  62. [LLamaDefaultLogger](./llama.common.llamadefaultlogger.md)<br>
  63. ### **DisableFile()**
  64. Disable writing log messages to file
  65. ```csharp
  66. public LLamaDefaultLogger DisableFile()
  67. ```
  68. #### Returns
  69. [LLamaDefaultLogger](./llama.common.llamadefaultlogger.md)<br>
  70. ### **Log(String, String, LogLevel)**
  71. Log a message
  72. ```csharp
  73. public void Log(string source, string message, LogLevel level)
  74. ```
  75. #### Parameters
  76. `source` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  77. The source of this message (e.g. class name)
  78. `message` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  79. The message to log
  80. `level` [LogLevel](./llama.common.illamalogger.loglevel.md)<br>
  81. Severity level of this message
  82. ### **Info(String)**
  83. Write a log message with "Info" severity
  84. ```csharp
  85. public void Info(string message)
  86. ```
  87. #### Parameters
  88. `message` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  89. ### **Warn(String)**
  90. Write a log message with "Warn" severity
  91. ```csharp
  92. public void Warn(string message)
  93. ```
  94. #### Parameters
  95. `message` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  96. ### **Error(String)**
  97. Write a log message with "Error" severity
  98. ```csharp
  99. public void Error(string message)
  100. ```
  101. #### Parameters
  102. `message` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>