rotatelog-go

module
v0.0.0-...-612bd03 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2021 License: MIT

README

rotatelog-go

a log rotation writer, support daily logging.

Usage

package logutils

import (
	"github.com/K265/rotatelog-go/pkg/rotatelog/daily"
	"github.com/sirupsen/logrus"
)
 
func init() {
	w := daily.New(
		"/var/log/server.", // prefix
		".log",             // extension
		30,                 // keep days
		100*1024*1024,      // maximum size
        nil                 // notifier.OnOpenFile(file *os.File) will be called when opened new file
	)
	logrus.SetOutput(w)
}

This will generate logs like /var/log/server.2021-09-07.0.log...

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL