Categorygithub.com/ttys3/rotatefilehook
modulepackage
1.0.0
Repository: https://github.com/ttys3/rotatefilehook.git
Documentation: pkg.go.dev

# README

RotateFileHook

This is a simple hook for logrus to write rotated log files using https://github.com/natefinch/lumberjack

Example

package main

import (
	"github.com/sirupsen/logrus"
	"github.com/ttys3/rotatefilehook"
)

rotateFileHook, err := rotatefilehook.NewRotateFileHook(rotatefilehook.RotateFileConfig{
    Filename:   "logfile.log",
    MaxSize:    5, // the maximum size in megabytes
    MaxBackups: 7, // the maximum number of old log files to retain
    MaxAge:     7, // the maximum number of days to retain old log files
    LocalTime:  true,
    Level:      logrus.DebugLevel,
    Formatter:  &logrus.TextFormatter{FullTimestamp: true},
})
if err != nil {
    panic(err)
}
var logger = logrus.New()
logger.AddHook(rotateFileHook)

# Functions

No description provided by the author

# Structs

No description provided by the author
No description provided by the author