mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 19:03:29 +08:00
- 将ILogAppender接口继承IDisposable以支持资源释放 - 添加ITimeProvider和SystemTimeProvider接口及实现类 - 创建FakeTimeProvider用于测试时间控制 - 修改SamplingFilter支持时间提供者注入和最大日志记录器数量限制 - 为SamplingFilter添加过期状态清理功能 - 修改StatisticsAppender使用时间提供者并实现IDisposable - 更新相关单元测试以使用FakeTimeProvider进行精确时间控制 - 在测试类中为模拟追加器添加Dispose方法实现
12 lines
283 B
C#
12 lines
283 B
C#
namespace GFramework.Core.Abstractions.time;
|
|
|
|
/// <summary>
|
|
/// 时间提供者接口,用于抽象时间获取以支持测试
|
|
/// </summary>
|
|
public interface ITimeProvider
|
|
{
|
|
/// <summary>
|
|
/// 获取当前 UTC 时间
|
|
/// </summary>
|
|
DateTime UtcNow { get; }
|
|
} |