rotate

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileWriter

type FileWriter struct {
	// contains filtered or unexported fields
}

func NewFileWriter

func NewFileWriter(opts ...Option) (*FileWriter, error)

func (*FileWriter) Close

func (w *FileWriter) Close() (err error)

Close implements io.Closer, and closes the current logfile.

func (*FileWriter) Write

func (w *FileWriter) Write(p []byte) (n int, err error)

Write implements io.Writer. If a write would cause the log file to be larger than maxBytes, the file is closed, rotate to include a timestamp of the current time.

type Option

type Option func(*FileWriter)

func WithCompress

func WithCompress(compress bool) Option

func WithFilename

func WithFilename(filename string) Option

func WithMaxAge

func WithMaxAge(maxAge time.Duration) Option

func WithMaxBackups

func WithMaxBackups(maxBackups int) Option

func WithMaxBytes

func WithMaxBytes(maxBytes int64) Option

func WithMergeCompressedBackups

func WithMergeCompressedBackups(merge bool) Option

Jump to

Keyboard shortcuts

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