Skip to content

v1.12.0

Choose a tag to compare

@taknb2nch taknb2nch released this 18 Nov 06:45
· 24 commits to develop since this release
74757fe

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 *Logger instances): A new SetLogLevel(level LogLevel) method has been added to the Logger struct. This allows you to dynamically change the log level of a specific logger instance at runtime. This operation is fully thread-safe (uses atomic).

🚀 Performance Optimizations

  • Lock-Free Log Level Checks (for *Logger instances): The internal mechanism for checking log levels on Logger instances (e.g., logger.IsInfoEnabled()) has been refactored.
    • The logLevel field now uses atomic.Uint32 instead of int.
    • All instance-level checks (logger.IsInfoEnabled()) are now lock-free atomic reads (Load). This improves performance when a single *Logger instance is used across multiple goroutines.
  • logLevelValue Type Change: The internal type logLevelValue has been changed from int to uint32 to align with the atomic.Uint32 type and ensure zero-cost type conversions during level checks.