go-relogger is a logger that supports to reopen logging file when traps signal or is passed a time interval. It can use to the logrotate(current logging file moves to an other logging file with suffix).
Because a logger prints previous logging file until logger reopens.
package main
import (
"os"
"time"
"github.com/gjbae1212/go-relogger"
)
func main() {
logger, err := NewReLogger("your-log-path", relogger.WithSignals([]os.Signal{
syscall.SIGHUP}),
relogger.WithRefreshDuration(time.Hour))
}
This project is following The MIT.