{"repo":"DeRuina/timberjack","free":true,"listed":false,"github":"https://github.com/DeRuina/timberjack","clone":"git clone https://github.com/DeRuina/timberjack.git","description":"Timberjack is a Go log rolling library with support for size-based, time-based, and manual rotation.","language":"Go","stars":157,"topics":["log-management","log-rolling","log-rotation","logging","rotation","time-based-rotation"],"license":"MIT","category":"analytics","readme_excerpt":"timberjack Timberjack is a Go package for writing logs to rolling files. Timberjack is a forked and enhanced version of lumberjack , adding time-based rotation, clock-scheduled rotation, and opt-in compression (gzip or zstd). Package timberjack provides a rolling logger with support for size-based and time-based log rotation. Installation Import Timberjack is a pluggable component that manages log file writing and rotation. It works with any logger that writes to an io.Writer , including the standard library’s log package. Logger also satisfies zapcore.WriteSyncer (from go.uber.org/zap ), so it can be passed directly to zapcore.NewCore or wrapped with zapcore.AddSync . ⚠️ Timberjack assumes one process writes to a given file. Reusing the same config from multiple processes on the same machine may lead to unexpected behavior. Example To use timberjack with the standard library's log package, including interval-based and scheduled minute/daily rotation: Manual rotation (e.g. on SIGHUP ): Use with go.uber.org/zap Logger satisfies zapcore.WriteSyncer , so you can plug it straight into a zap core: Logger Configuration How Rotation Works 1. Size-Based : If a write operation causes the current log file to exceed MaxSize , the file is rotated before the write. The backup filename will include -size as the reason. 2. Time-Based (Interval) : If RotationInterval is set (e.g., 24 time.Hour for daily rotation) and this duration has passed since the last rotation (of any type that updates ","default_branch":null,"files":null,"tree":[],"storefront":"/r/DeRuina","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/DeRuina/timberjack/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}