• v1.1.0 6112a707c7

    1.1.0 Stable

    ScuroNeko released this 2026-03-17 14:43:28 +03:00 | 2 commits to main since this release

    What's changed

    This release fixes a shutdown bug in slog caused by recursive error logging and unsafe writer ownership.

    Fixed

    • Logger.Close() no longer logs writer.Close() errors through the same logger instance
    • writer errors during print / println no longer trigger recursive l.Error(err) calls
    • stdout-based writers no longer close os.Stdout
    • generic CreateTextWriter / CreateJsonWriter no longer close externally provided writers
    • Close() now returns aggregated writer close errors instead of silently returning nil
    • non-closable external writers no longer cause panics on Close()

    Internal changes

    • file-based writers explicitly own and close the files they create
    • stdout and externally injected writers are treated as non-owning
    • added regression tests for:
      • writer Print() errors without recursion
      • aggregated Close() errors
      • safe Close() behavior for stdout writers
      • safe Close() behavior for non-owning external writers

    Impact

    This removes a class of hangs / recursion failures during logger shutdown and makes writer lifecycle behavior explicit and predictable.

    Compatibility note

    CreateTextWriter(io.Writer, ...) and CreateJsonWriter(io.Writer, ...) are now non-owning by design. If you pass a closable writer such as *os.File through these constructors, closing that writer is now the caller's responsibility. If you want the logger to own the file lifecycle, use CreateTextFileWriter(...) or CreateJsonFileWriter(...).

    Downloads