Feature/logger enhancement#58
Merged
Merged
Conversation
- 将 AbstractLogger 实现从 ILogger 扩展为 IStructuredLogger 接口 - 添加通用日志方法 Log(LogLevel, string, params object[]) 支持格式化参数 - 实现结构化日志方法支持属性键值对记录 - 添加 ConsoleAppender、FileAppender 和 AsyncLogAppender 日志输出器 - 实现 CompositeFilter 过滤器和 DefaultLogFormatter、JsonLogFormatter 格式化器 - 在 ConsoleLogger 和 GodotLogger 中使用预缓存的日志级别字符串提升性能 - 使用 ANSI 颜色代码替代 ConsoleColor 实现跨平台日志着色 - 在 ConsoleLoggerFactoryProvider 和 GodotLoggerFactoryProvider 中添加日志工厂缓存 - 优化 FileStorage 中目录遍历使用 OfType<string>() 类型转换 - 添加 LogContext 支持异步流中的结构化属性传递
- 为 AsyncLogAppender 添加完整功能测试,包括异步写入、缓冲区管理、并发处理等场景 - 为 CachedLoggerFactory 添加缓存机制测试,验证相同名称和级别的日志记录器重用 - 为 CompositeFilter 添加过滤器组合测试,验证多个过滤器的逻辑组合功能 - 为 CompositeLogger 添加复合日志记录器测试,验证多追加器写入和级别过滤功能 - 为 ConsoleAppender 添加控制台追加器测试,验证格式化输出和过滤器支持 - 为 DefaultLogFormatter 添加默认格式化器测试,验证基本格式化和异常处理功能 - 为 FileAppender 添加文件追加器测试,验证文件写入、目录创建和追加模式功能 - 为 JsonLogFormatter 添加 JSON 格式化器测试,验证 JSON 输出和属性序列化功能 - 为 LogContext 添加日志上下文测试,验证属性推送和作用域管理功能
- 添加 JsonStringEnumConverter 支持枚举的驼峰命名转换 - 实现 ConfigurableLoggerFactory 的 IDisposable 接口确保资源正确释放 - 支持日志级别配置的前缀匹配功能(命名空间层级匹配) - 优化测试代码中的资源管理,使用 using 语句确保对象正确释放 - 修复 JsonLogFormatter 测试中的属性访问逻辑,使用 TryGetProperty 安全访问 - 将测试中的异常断言从 ArgumentNullException 更新为 ArgumentException
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| C# | Feb 26, 2026 11:52a.m. | Review ↗ | |
| Secrets | Feb 26, 2026 11:52a.m. | Review ↗ |
- 将时间戳从本地时间改为UTC时间以提高一致性 - 使用ToUpperInvariant替代ToUpper提高文化区域安全性 - 简化LogContext中的空值检查逻辑 - 重构CompositeDisposable类以使用主构造函数语法 - 更新测试代码中的时间戳处理方式
- 将所有DateTime.Now替换为DateTime.UtcNow以确保时区一致性 - 修复文档中的时间戳记录方式 - 更新测试代码中的时间戳生成逻辑 - 统一框架各模块的时间记录标准
- 重构 Constructor_ShouldCreateDirectoryIfNotExists 测试方法名称为更描述性的格式 - 使用 using 语句块确保 FileAppender 资源得到正确释放 - 改进测试代码结构以提高可读性和资源清理可靠性
This was referenced Mar 15, 2026
This was referenced May 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.