rotatefile

  • 24th June 2026

rotatefile: log rotation, compression, and cleanup for Go

Go’s standard logging packages can write to an io.Writer, but they do not decide when a log file should rotate, how many old files to keep, or when disk usage should be capped. Once a service writes logs to local files, those details become part of the system.

github.com/gookit/rotatefile stays deliberately small: it provides an io.Writer with file rotation, gzip compression, and cleanup. You can keep using log/slog, log, zap, or gookit/slog; rotatefile only handles the file lifecycle.

rotatefile poster

Read more