esl_rotate

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnlimitedBackups = -1
	UnlimitedQuota   = -1
)
View Source
const (
	RotateEnqueueTimeout = 10 * time.Second
)

Variables

View Source
var (
	ErrorLogFileNotAvailable = errors.New("log file is not available")
)

Functions

func Shutdown

func Shutdown()

func Startup

func Startup()

Types

type MsgOut

type MsgOut struct {
	Path string
	Opts RotateOpts
}

type MsgPurge

type MsgPurge struct {
	Path string
	Opts RotateOpts
}

type MsgRotate

type MsgRotate struct {
	Opts RotateOpts
}

type RotateHook

type RotateHook func(path string)

Hook function that called when the log exceeds num backups. The file will be deleted after this function call.

type RotateOpt

type RotateOpt func(o RotateOpts) RotateOpts

func BaseName

func BaseName(name string) RotateOpt

Log file name without suffix

func BasePath

func BasePath(path string) RotateOpt

Path to the log file

func ChunkSize

func ChunkSize(size int64) RotateOpt

Maximum size target for the single log file. Log file could exceed this size, but should not exceed too much.

func Compress

func Compress() RotateOpt

Compress the log file on rotate

func CompressEnabled

func CompressEnabled(enabled bool) RotateOpt

Compress the log file on rotate

func HookBeforeDelete

func HookBeforeDelete(hook RotateHook) RotateOpt

Hook function that called when just before the file deleted.

func NumBackup

func NumBackup(num int) RotateOpt

Number of backups

func Quota

func Quota(quota int64) RotateOpt

func Uncompressed

func Uncompressed() RotateOpt

Stay uncompressed the log file on rotate

type RotateOpts

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

Rotate options

func NewRotateOpts

func NewRotateOpts() RotateOpts

func (RotateOpts) Apply

func (z RotateOpts) Apply(opts ...RotateOpt) RotateOpts

Apply all opts

func (RotateOpts) BaseName

func (z RotateOpts) BaseName() string

func (RotateOpts) BasePath

func (z RotateOpts) BasePath() string

func (RotateOpts) ChunkSize

func (z RotateOpts) ChunkSize() int64

func (RotateOpts) CurrentLogs

func (z RotateOpts) CurrentLogs() (entries []os.FileInfo, err error)

func (RotateOpts) CurrentName

func (z RotateOpts) CurrentName() string

Generate name of the current log file

func (RotateOpts) CurrentPath

func (z RotateOpts) CurrentPath() string

Generate path to the current log file.

func (RotateOpts) IsCompress

func (z RotateOpts) IsCompress() bool

func (RotateOpts) PurgeTargets

func (z RotateOpts) PurgeTargets() (purge []string, err error)

type Writer

type Writer interface {
	io.WriteCloser
	Open(opts ...RotateOpt) error
	UpdateOpt(opt RotateOpt)
}

func NewWriter

func NewWriter(basePath, baseName string) Writer

Jump to

Keyboard shortcuts

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