logger

package
v1.34.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: MIT Imports: 14 Imported by: 17

Documentation

Index

Constants

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

Keep those constants for backward compatibility even though they are not used anywhere. See https://github.com/influxdata/telegraf/pull/15514 for more details.

Deprecated: Those constants are unused and deprecated. The removal is scheduled for v1.45.0, if you use them please adapt your code!

Variables

This section is empty.

Functions

func CloseLogging added in v1.31.0

func CloseLogging() error

func New added in v1.32.0

func New(category, name, alias string) *logger

New creates a new logging instance to be used in models

func RedirectLogging added in v1.32.0

func RedirectLogging(w io.Writer)

func SetupLogging

func SetupLogging(cfg *Config) error

SetupLogging configures the logging output.

Types

type Config added in v1.31.0

type Config struct {
	// will set the log level to DEBUG
	Debug bool
	// will set the log level to ERROR
	Quiet bool
	// format and target of log messages
	LogTarget string
	LogFormat string
	Logfile   string
	// will rotate when current file at the specified time interval
	RotationInterval time.Duration
	// will rotate when current file size exceeds this parameter.
	RotationMaxSize int64
	// 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
	// Logger instance name
	InstanceName string
	// Structured logging message key
	StructuredLogMessageKey string
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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