rotation

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	Now() time.Time
}

Clock is the interface used to determine the current time

type Option

type Option func(*RotateLogs)

Option is a functional option for RotateLogs

func WithClock

func WithClock(clock Clock) Option

WithClock sets a custom clock for testing

func WithRotationCount

func WithRotationCount(count uint) Option

WithRotationCount sets the number of files to keep

func WithRotationTime

func WithRotationTime(d time.Duration) Option

WithRotationTime sets the rotation interval

type RotateLogs

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

RotateLogs represents a log file that gets automatically rotated

func New

func New(pattern string, options ...Option) (*RotateLogs, error)

New creates a new RotateLogs instance

func (*RotateLogs) Close

func (rl *RotateLogs) Close() error

Close closes the current log file

func (*RotateLogs) Write

func (rl *RotateLogs) Write(p []byte) (n int, err error)

Write implements io.Writer interface

type Strftime

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

Strftime provides strftime-like formatting for filenames

func NewStrftime

func NewStrftime(pattern string) (*Strftime, error)

NewStrftime creates a new Strftime formatter

func (*Strftime) Format

func (s *Strftime) Format(t time.Time) string

Format formats the time according to the pattern

Jump to

Keyboard shortcuts

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