rotate

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KB is one kilobyte
	KB int = 1024
	// MB is one megabyte
	MB int = KB * 1024
	// GB is one gigabyte
	GB int = MB * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(w *Writer) error

Option is the type for a rotate.Writer create option

func WithFileCount

func WithFileCount(c int) Option

WithFileCount defines the maximum number of files before old files will be deleted

func WithFileOpErrHandler

func WithFileOpErrHandler(h func(err error)) Option

WithFileOpErrHandler defines an error-handler for file operations

func WithFileSize

func WithFileSize(s int) Option

WithFileSize defines the maximum size for a log-file before it gets rotated

type Writer

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

Writer implements the log.Writer interface. It performs a log-file rotation based on the provided parameters

func NewWriter

func NewWriter(path string, opts ...Option) (*Writer, error)

NewWriter creates a new rotate.Writer

func (*Writer) Close

func (w *Writer) Close()

Close closes the writer and all related resources

func (*Writer) Write

func (w *Writer) Write(e entry.Entry)

Write writes an entry to the current log-file

Jump to

Keyboard shortcuts

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