Releases: arun0009/go-logger
Releases · arun0009/go-logger
go-logger v1.0.0
This release marks a complete modernization of the go-logger library, transitioning it to Go 1.26 with a focus on structured logging, high performance, and context awareness.
Major Highlights
Standardized Structured Logging: The Logger interface now exclusively uses keyvals ...any (consistent with Go's log/slog), ensuring a uniform API across all logging backends.
Go 1.26 Native Integration:
- Utilizes slog.NewMultiHandler for a new NewMultiLogger helper to fan out logs to multiple destinations.
- Utilizes slog.DiscardHandler for a zero-allocation Discard() logger.
- Modernized all benchmarks to use the new testing.B.Loop() pattern for more accurate performance verification.
Rich Adapter Ecosystem: Full support and verified adapters for:
- Zap (Uber)
- Zerolog (High-performance leader)
- Slog (Go Standard Library)
- Logrus (Legacy support)
Deep Context Support: Native WithContext propagation. Standardized context metadata extraction across all adapters using type-safe keys to prevent collisions.
Improvements & Refactoring
- Type Safety: Replaced all instances of interface{} with Go's any.
- Global Accessors: Restored and modernized logger.L() and logger.ReplaceGlobals() to support both Dependency Injection and Global Singleton patterns.
- Internal Helper: Added a logger.WithFields(ctx, keyvals...) helper for type-safe context field injection.
- Performance: Optimized adapter implementations to minimize allocations. Benchmarks on Apple M4 show Zerolog delivering ~170 ns/op.