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

29 lines
915 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>
public interface ILog
{
/// <summary>
/// 记录指定级别的日志消息
/// </summary>
/// <param name="level">日志级别</param>
/// <param name="message">日志消息内容</param>
/// <param name="exception">可选的异常对象默认为null</param>
/// <param name="context">可选的上下文对象默认为null</param>
void Log(
LogLevel level,
string message,
Exception? exception = null,
object? context = null
);
/// <summary>
/// 检查指定日志级别是否已启用
/// </summary>
/// <param name="level">要检查的日志级别</param>
/// <returns>如果指定级别已启用则返回true否则返回false</returns>
bool IsEnabled(LogLevel level);
}