rotatefilehook
rotatefilehook copied to clipboard
This is a logrus hook for rotating log files. This is basically a wrapper around the lumberjack library.
RotateFileHook
This is a simple hook for logrus to write log files using https://github.com/natefinch/lumberjack
import ("github.com/snowzach/rotatefilehook")
rotateFileHook, err := rotatefilehook.NewRotateFileHook(rotatefilehook.RotateFileConfig{
Filename: "logfile.log",
MaxSize: 5,
MaxBackups: 7,
MaxAge: 7,
Level: logrus.LevelDebug,
Formatter: logrus.TextFormatter,
})