logger

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

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

Logger abstracts pareto logger.

func NewLogger

func NewLogger(opt *Options) *Logger

NewLogger creates a new logger with the given options.

type Options

type Options struct {
	// "v", "vv", or "vvv"
	Verbosity string `json:"verbosity,omitempty" yaml:"verbosity"`

	// stdout/stderr or filename
	LogFileName string `json:"logFileName,omitempty" yaml:"logFileName"`

	// Max size in MB of the log file before it gets rotated. It defaults to 100MB.
	MaxSize int `json:"maxSize,omitempty" yaml:"maxSize"`

	// Max number of days to retain old log files based on the timestamp encoded in their filename.
	//
	// It defaults to 7 days.
	MaxAge int `json:"maxAge,omitempty" yaml:"maxAge"`

	// Max number of old log files to retain.
	// It defaults to 3 files.
	//
	// Any files older than MaxAge days are deleted, regardless of MaxBackups.
	//
	// If MaxBackups and MaxAge are both 0, no old log files will be deleted.
	MaxBackups int `json:"maxBackups,omitempty" yaml:"maxBackups"`
}

Options defines creation option of logger.

Jump to

Keyboard shortcuts

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