Documentation
¶
Overview ¶
Package logs contain methods to configure Agent logs
Index ¶
- func BuildJMXLogger(logFile, syslogURI string, syslogRFC, logToConsole, jsonFormat bool, ...) (log.LoggerInterface, error)
- func GetSyslogURI(cfg pkgconfigmodel.Reader) string
- func NewLogWriter(additionalDepth int, logLevel log.LogLevel) (io.Writer, error)
- func NewTLSHandshakeErrorWriter(additionalDepth int, logLevel log.LogLevel) (io.Writer, error)
- func SetupDogstatsdLogger(logFile string, cfg pkgconfigmodel.Reader) (log.LoggerInterface, error)
- func SetupLogger(loggerName LoggerName, logLevel, logFile, syslogURI string, ...) error
- type LoggerName
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildJMXLogger ¶ added in v0.71.0
func BuildJMXLogger(logFile, syslogURI string, syslogRFC, logToConsole, jsonFormat bool, cfg pkgconfigmodel.Reader) (log.LoggerInterface, error)
BuildJMXLogger returns a logger with JMX logger name and log level if a non empty logFile is provided, it will also log to the file a non empty syslogURI will enable syslog, and format them following RFC 5424 if specified you can also specify to log to the console and in JSON format
func GetSyslogURI ¶
func GetSyslogURI(cfg pkgconfigmodel.Reader) string
GetSyslogURI returns the configured/default syslog uri. Returns an empty string when syslog is disabled.
func NewLogWriter ¶
NewLogWriter returns a logWriter set with given logLevel. Returns an error if logLevel is unknown/not set.
func NewTLSHandshakeErrorWriter ¶
NewTLSHandshakeErrorWriter is a wrapper function which creates a new logWriter.
func SetupDogstatsdLogger ¶
func SetupDogstatsdLogger(logFile string, cfg pkgconfigmodel.Reader) (log.LoggerInterface, error)
SetupDogstatsdLogger returns a logger with dogstatsd logger name and log level if a non empty logFile is provided, it will also log to the file
func SetupLogger ¶
func SetupLogger(loggerName LoggerName, logLevel, logFile, syslogURI string, syslogRFC, logToConsole, jsonFormat bool, cfg pkgconfigmodel.Reader) error
SetupLogger sets up a logger with the specified logger name and log level if a non empty logFile is provided, it will also log to the file a non empty syslogURI will enable syslog, and format them following RFC 5424 if specified you can also specify to log to the console and in JSON format
Types ¶
type LoggerName ¶
type LoggerName string
LoggerName specifies the name of an instantiated logger.
const ( CoreLoggerName LoggerName = "CORE" JMXLoggerName LoggerName = "JMXFETCH" DogstatsDLoggerName LoggerName = "DOGSTATSD" )
Constant values for LoggerName.