(new): add threshold-based log level filtering and docs
Golang lint / lint (push) Successful in 1m36s
Golang lint / lint (push) Successful in 1m36s
- add threshold-aware LogLevel constructors - add Logger.SetThresholdMode and SameThreshold - preserve legacy SameLevel behavior for compatibility - extend tests for threshold mode and compatibility - update README and release notes for v2.2.0
This commit is contained in:
+16
-5
@@ -1,6 +1,8 @@
|
||||
# Unreleased (planned v2.2.0)
|
||||
|
||||
This release expands the public LogLevel API, adds HTTP method helpers, and improves package documentation and test coverage.
|
||||
This release expands the public LogLevel API, adds optional threshold-based
|
||||
filtering alongside the legacy severity ordering, and improves documentation
|
||||
and test coverage.
|
||||
|
||||
### Added
|
||||
|
||||
@@ -15,6 +17,9 @@ This release expands the public LogLevel API, adds HTTP method helpers, and impr
|
||||
- `NewFatalLogLevelWithColors`
|
||||
- `NewDebugLogLevel`
|
||||
- `NewDebugLogLevelWithColors`
|
||||
- Added threshold-aware log level constructors:
|
||||
- `NewThresholdLogLevel`
|
||||
- `NewThresholdLogLevelWithColors`
|
||||
- Added HTTP method-specific predefined log levels:
|
||||
- `HTTPGetLevel`
|
||||
- `HTTPHeadLevel`
|
||||
@@ -28,24 +33,30 @@ This release expands the public LogLevel API, adds HTTP method helpers, and impr
|
||||
- `HTTPUnknownLevel`
|
||||
- Added `LogLevelForMethod(method string) LogLevel` to map HTTP methods to predefined log levels.
|
||||
- Added `Logger.Printf(level, format, args...)` for formatted logging with an explicit log level.
|
||||
- Added `LogLevel.SameLevel` and `LogLevel.Equal` for severity-only and full level comparisons.
|
||||
- Added `Logger.SetThresholdMode(bool)` to switch filtering from legacy severity-index ordering to threshold-based ordering.
|
||||
- Added `LogLevel.SameLevel`, `LogLevel.SameThreshold`, and `LogLevel.Equal` for severity-only, threshold-only, and full level comparisons.
|
||||
|
||||
### Changed
|
||||
|
||||
- Refactored log level definitions into a dedicated `levels.go` file.
|
||||
- Unified `Logger.Print` and `Logger.Println` through a shared internal implementation without changing their behavior.
|
||||
- Expanded test coverage for `Logger.Printf`, HTTP level mapping, and new level constructors.
|
||||
- Common helper constructors such as `NewInfoLogLevel` now also assign threshold values while preserving legacy severity indexes.
|
||||
- `LogLevel.Equal` now 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 level comparison helpers and explicit-level formatted logging.
|
||||
- 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, and color APIs remain compatible.
|
||||
- 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.
|
||||
- `SameLevel` remains severity-only for backward compatibility, even when levels carry threshold metadata.
|
||||
|
||||
# v2.1.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user