GeWuYou fdaac135f9 feat(logging): 添加日志记录系统的基础实现
- 定义了ILog接口,提供日志记录和级别检查功能
- 实现了GodotLogger类,将日志输出到Godot控制台
- 创建了ILoggerFactory接口用于创建日志记录器实例
- 添加了Log静态类提供全局日志记录功能
- 定义了LogLevel枚举标识不同严重程度的日志级别
- 实现了NullLogger用于禁用日志记录功能
2025-12-23 12:52:07 +08:00

25 lines
897 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.

namespace GFramework.Core.logging;
/// <summary>
/// 空日志记录器实现,用于禁用日志记录功能
/// </summary>
internal sealed class NullLogger : ILog
{
/// <summary>
/// 记录日志消息(空实现,不执行任何操作)
/// </summary>
/// <param name="level">日志级别</param>
/// <param name="message">日志消息</param>
/// <param name="exception">相关异常对象(可选)</param>
/// <param name="context">日志上下文信息(可选)</param>
public void Log(LogLevel level, string message, Exception? exception, object? context) { }
/// <summary>
/// 检查指定日志级别是否启用
/// </summary>
/// <param name="level">要检查的日志级别</param>
/// <returns>始终返回 false表示所有日志级别都被禁用</returns>
public bool IsEnabled(LogLevel level) => false;
}