REPOSITORY / ScuroNeko/SNekLog

Releases

RELEASES REPOSITORY
  • v2.2.0 e6d15b530f

    2.2.0
    Golang lint / lint (push) Successful in 1m36s
    Stable

    ScuroNeko released this 2026-04-28 09:45:40 +03:00 | 2 commits to main since this release

    This 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:
      • NewInfoLogLevel
      • NewInfoLogLevelWithColors
      • NewWarnLogLevel
      • NewWarnLogLevelWithColors
      • NewErrorLogLevel
      • NewErrorLogLevelWithColors
      • NewFatalLogLevel
      • NewFatalLogLevelWithColors
      • NewDebugLogLevel
      • NewDebugLogLevelWithColors
    • Added threshold-aware log level constructors:
      • NewThresholdLogLevel
      • NewThresholdLogLevelWithColors
    • 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.
    • 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.
    • 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 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.
    • SameLevel remains severity-only for backward compatibility, even when levels carry threshold metadata.

    Full Changelog: v2.1.0...v2.2.0

    Downloads