Documentation
¶
Index ¶
Constants ¶
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 AddCallback ¶ added in v1.37.0
func AddCallback(callback CallbackFunc) (string, error)
AddCallback adds the given callback function to the registry and returns an ID that can be used for removing the callback later. Callback functions must not block or take a lot of time!
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 RemoveCallback ¶ added in v1.37.0
func RemoveCallback(id string)
RemoveCallback removes the callback function with the given ID from the registry
func SetupLogging ¶
SetupLogging configures the logging output.
Types ¶
type CallbackFunc ¶ added in v1.37.0
type CallbackFunc func( level telegraf.LogLevel, timestamp time.Time, source string, attributes map[string]interface{}, arguments ...interface{}, )
CallbackFunc is a function to be called when printing messages
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
}