GFramework/GFramework.Core/logging/NoopLoggerFactory.cs
GwWuYou 435c3398fc feat(logging): 添加日志级别配置和工厂提供程序
- 为 ILoggerFactory 接口添加 minLevel 参数支持
- 实现 ConsoleLoggerFactoryProvider 和 GodotLoggerFactoryProvider
- 创建 LoggerFactoryResolver 用于管理日志工厂提供程序
- 为 NoopLoggerFactory 添加日志级别参数
- 在 LogAttribute 中添加 MinLevel 属性
- 更新项目引用以支持日志级别配置功能
2026-01-01 20:37:12 +08:00

20 lines
702 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using GFramework.Core.Abstractions.logging;
namespace GFramework.Core.logging;
/// <summary>
/// 无操作日志工厂实现,用于提供空的日志记录功能
/// </summary>
public class NoopLoggerFactory : ILoggerFactory
{
/// <summary>
/// 获取指定名称的无操作日志记录器
/// </summary>
/// <param name="name">日志记录器的名称</param>
/// <param name="minLevel">日志记录器的最小日志级别</param>
/// <returns>返回一个NoopLogger实例该实例不执行任何实际的日志记录操作</returns>
public ILogger GetLogger(string name, LogLevel minLevel = LogLevel.Info)
{
return new NoopLogger();
}
}