Skip to content

v1.6.0

Choose a tag to compare

@wenjianzhang wenjianzhang released this 29 Jan 17:19

FEAT✨:

logger module enterprise-level four-layer architecture refactoring
add Logrus adapter with rich ecosystem (50+ Hooks support)
add Zap adapter with high performance and zero-allocation design
add Sampling plugin to prevent log storm (reduce 90%+ I/O)
add factory pattern for dynamic adapter registration
add complete YAML configuration support (424 lines)
add zero-allocation field definitions for performance optimization

REFACTOR🎨:

refactor logger module to four-layer architecture (Core → Adapter → Plugin → Output)
simplify sdk/pkg/logger/log.go from 68 lines to 11 lines as compatibility layer
remove conflicting logger/plugins/zap/* implementation
remove duplicate sdk/pkg/logger/options.go configuration file
update sdk/config/logger.go to use new logger API
externalize lumberjack rotation configuration (MaxSize, MaxAge, MaxBackups, Compress, LocalTime)
rename adapter_logrus.go to logrus.go following Go naming conventions

FIX🐛:

fix resource leak in zapLogger with proper Close() method implementation
fix sampling concurrent state bug by using pointer sharing instead of value copy
fix error handling in logger initialization
fix file resource management in zap adapter Init() method

PERF⚡:

improve logger performance by 1.8x (3,796 ns/op → 2,102 ns/op with Zap)
reduce memory allocation by 60% (1,631 B/op → 649 B/op)
reduce GC pressure by 83% (23 allocs/op → 4 allocs/op)
optimize sampling logger to 1,847 ns/op with 90%+ log reduction

TEST✅:

add comprehensive unit tests with race detector (PASS)
add benchmark tests for all adapters (Default/Zap/Sampling/Logrus)
add 8 runnable example tests for documentation

DOCS📝:

add logger architecture documentation
add migration guide for logger upgrade
add configuration examples and best practices

BREAKING CHANGES:

None - fully backward compatible with existing code