(new): add log level helpers and HTTP method levels
Golang lint / lint (push) Successful in 42s

- move LogLevel and predefined levels into levels.go
- add level-specific constructors for info/warn/error/fatal/debug
- add predefined HTTP method log levels and LogLevelForMethod
- unify Logger Print/Println internals and add Printf
- improve GoDoc coverage for exported APIs
This commit is contained in:
2026-04-27 16:36:30 +03:00
parent 3eac1851ec
commit 812caed471
8 changed files with 356 additions and 192 deletions
+46
View File
@@ -1,3 +1,49 @@
# v2.2.0
This release adds new public APIs for working with log levels, introduces HTTP method-specific log levels, and improves package documentation.
### Added
- Added dedicated log level constructors:
- `NewInfoLogLevel`
- `NewInfoLogLevelWithColors`
- `NewWarnLogLevel`
- `NewWarnLogLevelWithColors`
- `NewErrorLogLevel`
- `NewErrorLogLevelWithColors`
- `NewFatalLogLevel`
- `NewFatalLogLevelWithColors`
- `NewDebugLogLevel`
- `NewDebugLogLevelWithColors`
- Added HTTP method-specific predefined log levels:
- `HTTPGetLevel`
- `HTTPHeadLevel`
- `HTTPPostLevel`
- `HTTPPutLevel`
- `HTTPPatchLevel`
- `HTTPDeleteLevel`
- `HTTPOptionsLevel`
- `HTTPConnectLevel`
- `HTTPTraceLevel`
- `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.
### 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.
### Documentation
- Improved GoDoc coverage for exported types, constructors, formatters, colors, HTTP helpers, and time layouts.
- Expanded inline documentation for formatter tokens and default formatter behavior.
### Compatibility
- No breaking API changes.
- Existing `Print`, `Println`, predefined levels, and color APIs remain compatible.
# v2.1.0
This release expands sneklog color customization while preserving compatibility with the v2.0.1 API.