Skip to content

Feature/logger enhancement#58

Merged
GeWuYou merged 6 commits into
mainfrom
feature/logger-enhancement
Feb 26, 2026
Merged

Feature/logger enhancement#58
GeWuYou merged 6 commits into
mainfrom
feature/logger-enhancement

Conversation

@GeWuYou

@GeWuYou GeWuYou commented Feb 26, 2026

Copy link
Copy Markdown
Owner

No description provided.

- 将 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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @GeWuYou, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepsource-io

deepsource-io Bot commented Feb 26, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 445513b...57c4f8f on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

Important

Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. You can see those issues on the DeepSource dashboard.

PR Report Card

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 资源得到正确释放
- 改进测试代码结构以提高可读性和资源清理可靠性
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant