logger

package
v0.0.0-...-d018c20 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogStatic

func LogStatic(level LOGLEVEL, component string, msg string)

Log an error message directly to stdout / stderr.

level: loglevel for the message. component: the component where the log is coming from. msg: the log message.

Types

type LOGLEVEL

type LOGLEVEL int
const (
	ERROR LOGLEVEL = iota
	WARN
	INFO
)

Loglevel wrapper, for the end user (config file) the log level is specified with the actual number (0-2)

type LogMessage

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

Log message wrapper containing data for one log entry

type Logger

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

func NewLogger

func NewLogger(logLevel LOGLEVEL, logDebug bool, logQueueSize int) *Logger

Constructor for logger. logLevel: sets the logging level (error, warn, info). logDebug: enables or disables debug information in logs. logQueueSize: sets the size of the log queue. returns pointer to the logger instance.

func (*Logger) Launch

func (l *Logger) Launch() error

Starts async logger worker that processes log requests.

After a successful launch or shutdown, further calls to Launch will result in an error.

Returns an error if there is a failure while starting the worker.

func (*Logger) LogError

func (l *Logger) LogError(component string, msg string)

Log an error message.

component: the component where the log is coming from. msg the log message.

func (*Logger) LogInfo

func (l *Logger) LogInfo(component string, msg string)

Log an information message.

component: the component where the log is coming from. msg: the log message.

func (*Logger) LogWarn

func (l *Logger) LogWarn(component string, msg string)

Log a warning message.

component: the component where the log is coming from. msg: the log message.

func (*Logger) Shutdown

func (l *Logger) Shutdown()

Stops the logger worker and blocks until done.

The function is idempotent, meaning further calls to Shutdown will not result in an error.

Jump to

Keyboard shortcuts

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