Skip to content

v1.6.1

Choose a tag to compare

@wenjianzhang wenjianzhang released this 31 Jan 03:57

FEAT✨:

upgrade Go from 1.24.3 to 1.25.1 with full compatibility
add async logger with 45x performance improvement (3,358ns → 75ns)
add sampling logger with 29x performance improvement (3,357ns → 116ns)
add sanitizer logger for sensitive data protection and compliance
add 30+ performance benchmarks and 35 unit tests with Race Detector verified

REFACTOR🎨:

upgrade 119 dependency packages to latest stable versions (Casbin v2.135.0, Gin v1.11.0, GORM v1.31.1)
fix 6 test failures for Go 1.25 compatibility (config, sdk, storage, tools)
fix 3 async test data races for production-grade concurrency safety


Performance Improvements

Feature Improvement Latency Memory
Async Logger 45x 75ns 120 B/op
Sampling Logger 29x 116ns 16 B/op
Production Config (Async+Sampling+Sanitizer) 34x 98ns 149 B/op

Test Coverage

  • ✅ Unit Tests: 35/35 passed
  • ✅ Performance Benchmarks: 30+ passed
  • ✅ Concurrency Safety: Race Detector 0 warnings
  • ✅ Stress Tests: 100k+ QPS supported

Major Dependency Updates

github.com/casbin/casbin/v2         v2.128.0v2.135.0
github.com/casbin/gorm-adapter/v3   v3.37.0v3.41.0
github.com/gin-gonic/gin            v1.10.1v1.11.0
github.com/go-playground/validator/v10 v10.20.0v10.27.0
golang.org/x/crypto                 v0.37.0v0.47.0
google.golang.org/protobuf          v1.36.6v1.36.9
gorm.io/gorm                        v1.30.0v1.31.1

Usage Examples

Async Logger

baseLog := logger.NewLogrusLogger(
    logger.WithPath("logs/app.log"),
    logger.WithLevel(logger.InfoLevel),
)

asyncLog := logger.NewAsyncLogger(baseLog, logger.DefaultAsyncConfig)
defer asyncLog.(interface{ Close() error }).Close()

asyncLog.Log(logger.InfoLevel, "High performance logging")

Sampling Logger

samplingLog := logger.NewSamplingLogger(baseLog, logger.DefaultSamplingConfig)

for i := 0; i < 100; i++ {
    samplingLog.Log(logger.InfoLevel, "High frequency log")
}

Sanitizer Logger

sanitizerLog := logger.NewSanitizerLogger(baseLog, logger.DefaultSanitizerConfig)

sanitizerLog.Fields(map[string]interface{}{
    "phone":    "13812345678",  // → "138****5678"
    "password": "secret123",    // → "[REDACTED]"
}).Log(logger.InfoLevel, "User login")

Production Config (Recommended)

// Sanitizer → Sampling → Async
sanitized := logger.NewSanitizerLogger(baseLog, logger.DefaultSanitizerConfig)
sampled := logger.NewSamplingLogger(sanitized, logger.DefaultSamplingConfig)
asyncLog := logger.NewAsyncLogger(sampled, logger.DefaultAsyncConfig)
defer asyncLog.(interface{ Close() error }).Close()

asyncLog.Fields(map[string]interface{}{
    "phone":   "13812345678",
    "user_id": 12345,
}).Log(logger.InfoLevel, "User action")

Technical Documentation

Breaking Changes

No breaking changes. Fully backward compatible.

Links