Compare commits

..

No commits in common. "main" and "v1.5.4" have entirely different histories.
main ... v1.5.4

3 changed files with 4 additions and 7 deletions

View File

@ -1,11 +1,5 @@
# 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,6 +231,7 @@ 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

@ -80,12 +80,14 @@ 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 {