logger

package
v1.23.3 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: MIT Imports: 10 Imported by: 11

Documentation

Index

Constants

View Source
const (
	LogTargetFile   = "file"
	LogTargetStderr = "stderr"
)

Variables

This section is empty.

Functions

func SetupLogging

func SetupLogging(cfg LogConfig)

SetupLogging configures the logging output.

Types

type LogConfig

type LogConfig struct {
	// will set the log level to DEBUG
	Debug bool
	//will set the log level to ERROR
	Quiet bool
	//stderr, stdout, file or eventlog (Windows only)
	LogTarget string
	// will direct the logging output to a file. Empty string is
	// interpreted as stderr. If there is an error opening the file the
	// logger will fallback to stderr
	Logfile string
	// will rotate when current file at the specified time interval
	RotationInterval config.Duration
	// will rotate when current file size exceeds this parameter.
	RotationMaxSize config.Size
	// maximum rotated files to keep (older ones will be deleted)
	RotationMaxArchives int
	// pick a timezone to use when logging. or type 'local' for local time.
	LogWithTimezone string
}

LogConfig contains the log configuration settings

type LoggerCreator

type LoggerCreator interface {
	CreateLogger(cfg LogConfig) (io.Writer, error)
}

Jump to

Keyboard shortcuts

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