Documentation
¶
Index ¶
- Constants
- func CloseLogging() error
- func NewLogger(category, name, alias string) telegraf.Logger
- func SetupLogging(cfg Config) error
- type Config
- type Logger
- func (l *Logger) Debug(args ...interface{})
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Level() telegraf.LogLevel
- func (l *Logger) RegisterErrorCallback(f func())
- func (l *Logger) Warn(args ...interface{})
- func (l *Logger) Warnf(format string, args ...interface{})
Constants ¶
View Source
const ( LogTargetFile = "file" LogTargetStderr = "stderr" )
Variables ¶
This section is empty.
Functions ¶
func CloseLogging ¶ added in v1.31.0
func CloseLogging() error
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) Error ¶ added in v1.31.0
func (l *Logger) Error(args ...interface{})
Error logs an error message, patterned after log.Print.
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
Infof logs an information message, patterned after log.Printf.
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
Click to show internal directories.
Click to hide internal directories.