logs

package module
v0.52.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Overview

Package logs contain methods to configure Agent logs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeLogLevel

func ChangeLogLevel(level string) error

ChangeLogLevel immediately changes the log level to the given one.

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

func NewLogWriter(additionalDepth int, logLevel seelog.LogLevel) (io.Writer, error)

NewLogWriter returns a logWriter set with given logLevel. Returns an error if logLevel is unknown/not set.

func NewTLSHandshakeErrorWriter added in v0.51.0

func NewTLSHandshakeErrorWriter(additionalDepth int, logLevel seelog.LogLevel) (io.Writer, error)

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, level seelog.LogLevel, context seelog.LogContextInterface) error

ReceiveMessage process current log message

Directories

Path Synopsis
internal
seelog
Package seelog provides the configuration for the logger
Package seelog provides the configuration for the logger

Jump to

Keyboard shortcuts

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