Browse Source

Typo and formatting

tags/v0.5.1
sa_ddam213 2 years ago
parent
commit
a67ea36dd9
1 changed files with 20 additions and 20 deletions
  1. +20
    -20
      LLama/Common/Logger.cs

+ 20
- 20
LLama/Common/Logger.cs View File

@@ -16,7 +16,7 @@ public interface ILLamaLogger
Info = 4 Info = 4
} }
/// <summary> /// <summary>
/// Write the log in cosutomized way
/// Write the log in customized way
/// </summary> /// </summary>
/// <param name="source">The source of the log. It may be a method name or class name.</param> /// <param name="source">The source of the log. It may be a method name or class name.</param>
/// <param name="message">The message.</param> /// <param name="message">The message.</param>
@@ -26,7 +26,7 @@ public interface ILLamaLogger


/// <summary> /// <summary>
/// The default logger of LLamaSharp. On default it write to console. User methods of `LLamaLogger.Default` to change the behavior. /// The default logger of LLamaSharp. On default it write to console. User methods of `LLamaLogger.Default` to change the behavior.
/// It's more recommended to inherit `ILLamaLogger` to cosutomize the behavior.
/// It's more recommended to inherit `ILLamaLogger` to customize the behavior.
/// </summary> /// </summary>
public sealed class LLamaDefaultLogger : ILLamaLogger public sealed class LLamaDefaultLogger : ILLamaLogger
{ {
@@ -50,12 +50,12 @@ public sealed class LLamaDefaultLogger : ILLamaLogger
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public LLamaDefaultLogger EnableNative() public LLamaDefaultLogger EnableNative()
{
EnableNativeLogCallback();
return this;
}
{
EnableNativeLogCallback();
return this;
}


public LLamaDefaultLogger EnableConsole()
public LLamaDefaultLogger EnableConsole()
{ {
_toConsole = true; _toConsole = true;
return this; return this;
@@ -173,18 +173,18 @@ public sealed class LLamaDefaultLogger : ILLamaLogger
/// Register native logging callback /// Register native logging callback
/// </summary> /// </summary>
private void EnableNativeLogCallback() private void EnableNativeLogCallback()
{
{
// TODO: Move to a more appropriate place once we have a intitialize method // TODO: Move to a more appropriate place once we have a intitialize method
NativeApi.llama_log_set(NativeLogCallback);
}
/// <summary>
/// Callback for native logging function
/// </summary>
/// <param name="level">The log level</param>
/// <param name="message">The log message</param>
private void NativeLogCallback(LogLevel level, string message)
{
NativeApi.llama_log_set(NativeLogCallback);
}
/// <summary>
/// Callback for native logging function
/// </summary>
/// <param name="level">The log level</param>
/// <param name="message">The log message</param>
private void NativeLogCallback(LogLevel level, string message)
{
if (string.IsNullOrEmpty(message)) if (string.IsNullOrEmpty(message))
return; return;


@@ -192,7 +192,7 @@ public sealed class LLamaDefaultLogger : ILLamaLogger
// If your logging mechanism cannot handle that, check if the last character is '\n' and strip it // If your logging mechanism cannot handle that, check if the last character is '\n' and strip it
// if it exists. // if it exists.
// It might not exist for progress report where '.' is output repeatedly. // It might not exist for progress report where '.' is output repeatedly.
Log(default!, message.TrimEnd('\n'), level);
}
Log(default!, message.TrimEnd('\n'), level);
}


} }

Loading…
Cancel
Save