[fix]修正UdpServer在接收广播时连续启动接收的错误,在StarAgent中,此时可能收到广播包,SocketFlags是Broadcast,需要清空,否则报错“参考的对象类型不支持尝试的操作”; 无需设置SocketOptionName.PacketInformation,在ReceiveMessageFromAsync时会自动设置,并且支持ipv6;
石头 编写于 2024-10-10 00:36:00 石头 提交于 2024-10-10 00:45:43
X
namespace NewLife.Log;

/// <summary>日志功能接口</summary>
public interface ILogFeature
{
    /// <summary>日志。非空,默认为Logger.Null</summary>
    ILog Log { get; set; }
}

/// <summary>日志功能扩展</summary>
public static class LogFeatureExtensions
{
    /// <summary>写日志</summary>
    /// <param name="logFeature">日志功能</param>
    /// <param name="format">格式化字符串</param>
    /// <param name="args">格式化参数,特殊处理时间日期和异常对象</param>
    public static void WriteLog(ILogFeature logFeature, String format, params Object?[] args) => logFeature.Log?.Info(format, args);
}