golift.io/rotatorr (go): Package rotatorr is a log rotation module designed to plug directly into a standard go logger. It provides an input interface to handle log rotation, naming, and compression. Three additional modules packages are included to facilitate backup-file naming in different formats, and log compression.  The New() methods return a simple io.WriteCloser that works with most log packages. This interface handles log rotation while providing many features and overridable interfaces to customize the rotation experience. Inspired by Lumberjack: https://github.com/natefinch/lumberjack.  Use this package if you write your own log file, and you're tired of your log file growing indefinitely. The included `introtatorr` and `timerotator` modules allow a variety of naming conventions for backup files. They also include options to delete old files based on age, count, or both.  This is a simple example that enables log compression. Enabling compression on "Ascending Integer" log files is not recommend because it's possible for a log to be rotated (renamed) while being compressed. This is best utilized on Descending Integer or Time-based log files. Of course, these are all interfaces you can override, so customize away! The called CompressPostRotate procedure runs a compression in the background, and prints a log message when it completes.   Example_compressor_capture shows how to capture the response from a post-rotate compression so you can do whatever you want with it.   Example_compressor_log shows how to format a post-rotate compression log line.   This examples shows how to create backup logs files just like https://github.com/natefinch/lumberjack. This will rotate files at 100Mb and keep all old files (no cleanup). Backup log files are named with a time stamp. Compression isn't enabled.   This example demonstrates how to trigger an action after a file is rotated. All of the struct members for rotatorr.Config and timerotator.Layout are shown.
Keywords: golang-library|golang-package|logfiles|logrotate|logrotation