[feat]网络层增加Byte[]和ArraySegment的发送重载,直达底层,这是用户最常用的方法,也是性能最好的路径。
大石头 authored at 2024-11-19 10:06:42
796.00 B
X
namespace NewLife.Log;

/// <summary>依托于动作的日志类</summary>
public class ActionLog : Logger
{
    /// <summary>方法</summary>
    public Action<String, Object?[]> Method { get; set; }

    /// <summary>使用指定方法否则动作日志</summary>
    /// <param name="action"></param>
    public ActionLog(Action<String, Object?[]> action) => Method = action;

    /// <summary>写日志</summary>
    /// <param name="level"></param>
    /// <param name="format"></param>
    /// <param name="args"></param>
    protected override void OnWrite(LogLevel level, String format, params Object?[] args) => Method?.Invoke(format, args);

    /// <summary>已重载</summary>
    /// <returns></returns>
    public override String ToString() => Method + "";
}