logging

package
v6.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller is responsible for managing a set of loggers.

func NewLoggingController

func NewLoggingController(listener *events.InternalListener) *Controller

NewLoggingController instantiates a new LoggerController object.

func (*Controller) AddLogger

func (c *Controller) AddLogger(s *state.State, name string, loggerType string) error

AddLogger adds a new logger to the controller.

func (*Controller) Reconfigure

func (c *Controller) Reconfigure(s *state.State, config map[string]struct{}) error

Reconfigure handles the reinitialization of loggers after configuration changes.

func (*Controller) RemoveLogger

func (c *Controller) RemoveLogger(name string)

RemoveLogger removes a logger from the controller.

func (*Controller) Setup

func (c *Controller) Setup(s *state.State) error

Setup is responsible for preparing a new set of loggers.

func (*Controller) Shutdown

func (c *Controller) Shutdown()

Shutdown cleans up loggers.

type Entry

type Entry struct {
	Timestamp time.Time
	Line      string
}

Entry represents a log entry. It includes a log message and the time it occurred at.

func (Entry) MarshalJSON

func (e Entry) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON encoding of Entry.

type LabelSet

type LabelSet map[string]string

LabelSet is a key/value pair mapping of labels.

func (LabelSet) String

func (l LabelSet) String() string

String implements the Stringer interface. It returns a formatted/sorted set of label key/value pairs.

type Logger

type Logger interface {
	HandleEvent(event api.Event)
	Start() error
	Stop()
	Validate() error
}

Logger is an interface that must be implemented by all loggers.

func LoggerFromType

func LoggerFromType(s *state.State, loggerName string, loggerType string) (Logger, error)

LoggerFromType returns a new logger based on its type.

type LokiLogger

type LokiLogger struct {
	// contains filtered or unexported fields
}

LokiLogger represents a Loki client.

func NewLokiLogger

func NewLokiLogger(s *state.State, name string) (*LokiLogger, error)

NewLokiLogger returns a logger of loki type.

func (*LokiLogger) HandleEvent

func (l *LokiLogger) HandleEvent(event api.Event)

HandleEvent handles the event received from the internal event listener.

func (*LokiLogger) Start

func (l *LokiLogger) Start() error

Start starts the loki logger.

func (*LokiLogger) Stop

func (l *LokiLogger) Stop()

Stop stops the client.

func (*LokiLogger) Validate

func (l *LokiLogger) Validate() error

Validate checks whether the logger configuration is correct.

type PushRequest

type PushRequest struct {
	Streams []*Stream `json:"streams"`
}

PushRequest models a log stream push.

type Stream

type Stream struct {
	Labels  LabelSet `json:"stream"`
	Entries []Entry  `json:"values"`
}

Stream represents a log stream. It includes a set of log entries and their labels.

type SyslogLogger

type SyslogLogger struct {
	// contains filtered or unexported fields
}

SyslogLogger represents a syslog logger.

func NewSyslogLogger

func NewSyslogLogger(s *state.State, name string) (*SyslogLogger, error)

NewSyslogLogger instantiates a new syslog logger.

func (*SyslogLogger) HandleEvent

func (c *SyslogLogger) HandleEvent(event api.Event)

HandleEvent handles the event received from the internal event listener.

func (*SyslogLogger) Start

func (c *SyslogLogger) Start() error

Start starts the syslog logger.

func (*SyslogLogger) Stop

func (c *SyslogLogger) Stop()

Stop cleans up the syslog logger.

func (*SyslogLogger) Validate

func (c *SyslogLogger) Validate() error

Validate checks whether the logger configuration is correct.

Jump to

Keyboard shortcuts

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