logger

package
v1.31.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: MIT Imports: 10 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseLogging added in v1.31.0

func CloseLogging() error

func NewLogger added in v1.31.0

func NewLogger(category, name, alias string) telegraf.Logger

NewLogger creates a new logger instance

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
	//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 fall back to stderr
	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
}

Config contains the log configuration settings

type Logger added in v1.31.0

type Logger struct {
	Category string
	Name     string
	Alias    string
	LogLevel telegraf.LogLevel
	// contains filtered or unexported fields
}

Logger defines a logging structure for plugins.

func (*Logger) Debug added in v1.31.0

func (l *Logger) Debug(args ...interface{})

Debug logs a debug message, patterned after log.Print.

func (*Logger) Debugf added in v1.31.0

func (l *Logger) Debugf(format string, args ...interface{})

Debugf logs a debug message, patterned after log.Printf.

func (*Logger) Error added in v1.31.0

func (l *Logger) Error(args ...interface{})

Error logs an error message, patterned after log.Print.

func (*Logger) Errorf added in v1.31.0

func (l *Logger) Errorf(format string, args ...interface{})

Errorf logs an error message, patterned after log.Printf.

func (*Logger) Info added in v1.31.0

func (l *Logger) Info(args ...interface{})

Info logs an information message, patterned after log.Print.

func (*Logger) Infof added in v1.31.0

func (l *Logger) Infof(format string, args ...interface{})

Infof logs an information message, patterned after log.Printf.

func (*Logger) Level added in v1.31.0

func (l *Logger) Level() telegraf.LogLevel

func (*Logger) RegisterErrorCallback added in v1.31.0

func (l *Logger) RegisterErrorCallback(f func())

OnErr defines a callback that triggers only when errors are about to be written to the log

func (*Logger) Warn added in v1.31.0

func (l *Logger) Warn(args ...interface{})

Warn logs a warning message, patterned after log.Print.

func (*Logger) Warnf added in v1.31.0

func (l *Logger) Warnf(format string, args ...interface{})

Warnf logs a warning message, patterned after log.Printf.

Jump to

Keyboard shortcuts

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