Repository navigation
v1.12.0
v1.12.0 (2025-11-18)
This release adds dynamic log level control for Logger instances and optimizes their performance.
Note: These changes apply to Logger instances created via harelog.New(). The global (package-level) logger (harelog.Info etc.) and its stdMutex behavior remain unchanged.
✨ New Features
- Dynamic Log Level Control (for
*Loggerinstances): A newSetLogLevel(level LogLevel)method has been added to theLoggerstruct. This allows you to dynamically change the log level of a specific logger instance at runtime. This operation is fully thread-safe (usesatomic).
🚀 Performance Optimizations
- Lock-Free Log Level Checks (for
*Loggerinstances): The internal mechanism for checking log levels onLoggerinstances (e.g.,logger.IsInfoEnabled()) has been refactored.- The
logLevelfield now usesatomic.Uint32instead ofint. - All instance-level checks (
logger.IsInfoEnabled()) are now lock-free atomic reads (Load). This improves performance when a single*Loggerinstance is used across multiple goroutines.
- The
logLevelValueType Change: The internal typelogLevelValuehas been changed frominttouint32to align with theatomic.Uint32type and ensure zero-cost type conversions during level checks.