loggers

package
v2.16.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const EnvVarLogFormat = "MONACO_LOG_FORMAT"
View Source
const EnvVarLogTime = "MONACO_LOG_TIME"

Variables

This section is empty.

Functions

This section is empty.

Types

type LogFormat

type LogFormat int
const (
	LogFormatText LogFormat = iota
	LogFormatJSON
)

func ParseLogFormat

func ParseLogFormat(f string) LogFormat

type LogLevel

type LogLevel int
const (
	LevelInfo LogLevel = iota
	LevelDebug
	LevelError
	LevelWarn
	LevelFatal
)

type LogOptions

type LogOptions struct {
	// JSONLogging specifies whether log lines should be structured JSON logs with additional fields.
	// If deactivated text logs are written and (most) fields added by Logger.WithFields are omitted.
	JSONLogging bool
	// LogLevel specifies the log level to be used
	LogLevel LogLevel
	// LogSpy can be used as an additional log sink to capture the logs
	LogSpy io.Writer
	// LogTimeMode specifies which time mode shall be used when printing out logs
	LogTimeMode LogTimeMode
	// File is an optional file to write logs of level LogLevel and higher to
	File afero.File
	// ErrorFile is an optional file to write error level logs to
	ErrorFile afero.File
}

LogOptions holds different options that can be passed to setup the logger to change its behavior

type LogTimeMode

type LogTimeMode int
const (
	LogTimeLocal LogTimeMode = iota
	LogTimeUTC
)

func ParseLogTimeMode

func ParseLogTimeMode(m string) LogTimeMode

type Logger

type Logger interface {
	Info(msg string, args ...interface{})
	Error(msg string, args ...interface{})
	Debug(msg string, args ...interface{})
	Warn(msg string, args ...interface{})
	Fatal(msg string, args ...interface{})
	WithFields(fields ...field.Field) Logger
	Level() LogLevel
	GetLogr() logr.Logger
}

Logger defines the interface for a logging implementation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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