Skip to content

Commit

Permalink
减少日志器的委托对象创建
Browse files Browse the repository at this point in the history
  • Loading branch information
lindexi committed Sep 2, 2024
1 parent 379eabc commit d7a2cb4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/dotnetCampus.Logger/Log.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private set
/// </remarks>
public static void Trace(string message)
{
Current.Log(LogLevel.Trace, default, message, null, (s, ex) => message);
Current.Log(LogLevel.Trace, default, message, null, static (s, ex) => s);
}

/// <summary>
Expand All @@ -88,7 +88,7 @@ public static void Trace(string message)
/// </remarks>
public static void Debug(string message)
{
Current.Log(LogLevel.Debug, default, message, null, (s, ex) => message);
Current.Log(LogLevel.Debug, default, message, null, static (s, ex) => s);
}

/// <summary>
Expand All @@ -97,7 +97,7 @@ public static void Debug(string message)
/// <param name="message">要记录的消息。</param>
public static void Info(string message)
{
Current.Log(LogLevel.Information, default, message, null, (s, ex) => message);
Current.Log(LogLevel.Information, default, message, null, static (s, ex) => s);
}

/// <summary>
Expand All @@ -107,7 +107,7 @@ public static void Info(string message)
/// <param name="exception">如果有异常信息,可以传入此参数。</param>
public static void Warn(string message, Exception? exception = null)
{
Current.Log(LogLevel.Warning, default, message, exception, (s, ex) => message);
Current.Log(LogLevel.Warning, default, message, exception, static (s, ex) => s);
}

/// <summary>
Expand All @@ -117,7 +117,7 @@ public static void Warn(string message, Exception? exception = null)
/// <param name="exception">如果有异常信息,可以传入此参数。</param>
public static void Error(string message, Exception? exception = null)
{
Current.Log(LogLevel.Error, default, message, exception, (s, ex) => message);
Current.Log(LogLevel.Error, default, message, exception, static (s, ex) => s);
}

/// <summary>
Expand All @@ -127,6 +127,6 @@ public static void Error(string message, Exception? exception = null)
/// <param name="exception">如果有异常信息,可以传入此参数。</param>
public static void Fatal(string message, Exception? exception = null)
{
Current.Log(LogLevel.Critical, default, message, null, (s, ex) => message);
Current.Log(LogLevel.Critical, default, message, null, static (s, ex) => s);
}
}

0 comments on commit d7a2cb4

Please sign in to comment.