Skip to content

Commit

Permalink
Merge pull request #22 from dotnet-campus/t/lindexi/Message
Browse files Browse the repository at this point in the history
减少日志器的委托对象创建
  • Loading branch information
walterlv authored Sep 2, 2024
2 parents 379eabc + d7a2cb4 commit 085c0e3
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 085c0e3

Please sign in to comment.