REPOSITORY / ScuroNeko/SNekLog
Releases
-
released this
2026-04-28 09:45:40 +03:00 | 2 commits to main since this releaseThis release expands the public LogLevel API, adds optional threshold-based
filtering alongside the legacy severity ordering, and improves documentation
and test coverage.Added
- Added dedicated log level constructors:
NewInfoLogLevelNewInfoLogLevelWithColorsNewWarnLogLevelNewWarnLogLevelWithColorsNewErrorLogLevelNewErrorLogLevelWithColorsNewFatalLogLevelNewFatalLogLevelWithColorsNewDebugLogLevelNewDebugLogLevelWithColors
- Added threshold-aware log level constructors:
NewThresholdLogLevelNewThresholdLogLevelWithColors
- Added HTTP method-specific predefined log levels:
HTTPGetLevelHTTPHeadLevelHTTPPostLevelHTTPPutLevelHTTPPatchLevelHTTPDeleteLevelHTTPOptionsLevelHTTPConnectLevelHTTPTraceLevelHTTPUnknownLevel
- Added
LogLevelForMethod(method string) LogLevelto map HTTP methods to predefined log levels. - Added
Logger.Printf(level, format, args...)for formatted logging with an explicit log level. - Added
Logger.SetThresholdMode(bool)to switch filtering from legacy severity-index ordering to threshold-based ordering. - Added
LogLevel.SameLevel,LogLevel.SameThreshold, andLogLevel.Equalfor severity-only, threshold-only, and full level comparisons.
Changed
- Refactored log level definitions into a dedicated
levels.gofile. - Unified
Logger.PrintandLogger.Printlnthrough a shared internal implementation without changing their behavior. - Common helper constructors such as
NewInfoLogLevelnow also assign threshold values while preserving legacy severity indexes. LogLevel.Equalnow includes threshold configuration in full equality checks.- Expanded test coverage for
Logger.Printf, HTTP level mapping, constructor behavior, threshold filtering, and backward compatibility.
Documentation
- Improved GoDoc coverage for exported types, constructors, formatters, colors, HTTP helpers, and time layouts.
- Documented threshold mode, threshold-aware constructors, level comparison helpers, and explicit-level formatted logging.
- Expanded inline documentation for formatter tokens and default formatter behavior.
- Updated English and Russian README files with threshold-mode examples and comparison guidance.
Compatibility
- No breaking API changes.
- Existing
Print,Println, predefined levels,Level/SetLevel, and color APIs remain compatible. - Legacy severity ordering remains the default; threshold filtering is enabled only when
SetThresholdMode(true)is called. SameLevelremains severity-only for backward compatibility, even when levels carry threshold metadata.
Full Changelog: v2.1.0...v2.2.0
Downloads
- Added dedicated log level constructors: