Documentation ¶
Overview ¶
Package logs contain methods to configure Agent logs
Index ¶
- func GenerateLoggerInterface(logConfig *seelogCfg.Config) (seelog.LoggerInterface, error)
- func GetSyslogURI(cfg pkgconfigmodel.Reader) string
- func GetSyslogURIFromConfig(cfg pkgconfigmodel.Reader) string
- func NewLogWriter(additionalDepth int, logLevel seelog.LogLevel) (io.Writer, error)
- func NewTLSHandshakeErrorWriter(additionalDepth int, logLevel seelog.LogLevel) (io.Writer, error)
- func SetupDogstatsdLogger(logFile string, cfg pkgconfigmodel.Reader) (seelog.LoggerInterface, error)
- func SetupJMXLogger(logFile, syslogURI string, syslogRFC, logToConsole, jsonFormat bool, ...) error
- func SetupLogger(loggerName LoggerName, logLevel, logFile, syslogURI string, ...) error
- type LoggerName
- type SyslogReceiver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateLoggerInterface ¶
func GenerateLoggerInterface(logConfig *seelogCfg.Config) (seelog.LoggerInterface, error)
GenerateLoggerInterface return a logger Interface from a log config
func GetSyslogURI ¶
func GetSyslogURI(cfg pkgconfigmodel.Reader) string
GetSyslogURI returns the configured/default syslog uri. Returns an empty string when syslog is disabled.
func GetSyslogURIFromConfig ¶
func GetSyslogURIFromConfig(cfg pkgconfigmodel.Reader) string
GetSyslogURIFromConfig is like GetSyslogURI but reads from the provided config
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) (seelog.LoggerInterface, error)
SetupDogstatsdLogger sets up a logger with dogstatsd logger name and log level if a non empty logFile is provided, it will also log to the file
func SetupJMXLogger ¶
func SetupJMXLogger(logFile, syslogURI string, syslogRFC, logToConsole, jsonFormat bool, cfg pkgconfigmodel.Reader) error
SetupJMXLogger sets up 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 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.
type SyslogReceiver ¶
type SyslogReceiver struct {
// contains filtered or unexported fields
}
SyslogReceiver implements seelog.CustomReceiver
func (*SyslogReceiver) AfterParse ¶
func (s *SyslogReceiver) AfterParse(initArgs seelog.CustomReceiverInitArgs) error
AfterParse parses the receiver configuration
func (*SyslogReceiver) Close ¶
func (s *SyslogReceiver) Close() error
Close is a NOP in current implementation
func (*SyslogReceiver) Flush ¶
func (s *SyslogReceiver) Flush()
Flush is a NOP in current implementation
func (*SyslogReceiver) ReceiveMessage ¶
func (s *SyslogReceiver) ReceiveMessage(message string, _ seelog.LogLevel, _ seelog.LogContextInterface) error
ReceiveMessage process current log message