Compare commits

..

1 Commits
v1.5.4 ... main

Author SHA1 Message Date
AI Engineer
438a424d94 feat(log): normalize Warning level behavior, remove automatic stack traces 2026-06-05 11:31:32 +08:00
3 changed files with 7 additions and 4 deletions

View File

@ -1,5 +1,11 @@
# Changelog # Changelog
## [1.5.5] - 2026-06-05
- **规范化: Warning 日志行为对齐**:
- ** Convention 对齐**: 移除了 `Warning` 级别日志自动附带堆栈信息(`CallStacks`)的逻辑。
- **性能优化**: 减少了在产生非故障告警时的堆栈获取开销。
- **设计初衷**: 遵循主流日志规范,仅在 `Error` 级别及以上保留自动堆栈,使告警信息更整洁。
## [1.5.4] - 2026-06-05 ## [1.5.4] - 2026-06-05
- **架构重构: 灵活的日志降噪过滤器**: - **架构重构: 灵活的日志降噪过滤器**:
- **解耦**: 移除了包内针对特定第三方库(如 SugarDB的硬编码过滤逻辑。 - **解耦**: 移除了包内针对特定第三方库(如 SugarDB的硬编码过滤逻辑。

View File

@ -231,7 +231,6 @@ func (logger *Logger) FillInfo(entry *InfoLog, message string) {
func (logger *Logger) FillWarning(entry *WarningLog, message string) { func (logger *Logger) FillWarning(entry *WarningLog, message string) {
logger.FillBase(&entry.BaseLog, LogTypeWarning) logger.FillBase(&entry.BaseLog, LogTypeWarning)
entry.Warning = message entry.Warning = message
entry.CallStacks = getCallStacks(logger.truncations)
} }
func (logger *Logger) FillError(entry *ErrorLog, message string) { func (logger *Logger) FillError(entry *ErrorLog, message string) {

View File

@ -81,13 +81,11 @@ func (l *InfoLog) Reset() {
type WarningLog struct { type WarningLog struct {
BaseLog BaseLog
Warning string `log:"pos:6,color:yellow,withoutkey:true"` Warning string `log:"pos:6,color:yellow,withoutkey:true"`
CallStacks []string `log:"pos:1001"`
} }
func (l *WarningLog) Reset() { func (l *WarningLog) Reset() {
l.BaseLog.Reset() l.BaseLog.Reset()
l.Warning = "" l.Warning = ""
l.CallStacks = l.CallStacks[:0]
} }
type ErrorLog struct { type ErrorLog struct {