This package provides automatic log rotation for servers
Use the go
command:
$ go get github.com/rclancey/logrotate
package main
import (
"log"
"time"
)
func init() {
logFn := "/var/log/myServer/errors.log"
rotationPeriod := 24 * time.Hour
maxSize := 0
retainCount := 7
rotlog, err := logrotate.Open(logFn, rotationPeriod, maxSize, retainCount)
log.SetOutput(rotlog)
}
Documentation is hosted at GoDoc project.
Copyright (C) 2019-2020 by Ryan Clancey
Package released under MIT License. See LICENSE for details.