loggers

package
v2.6.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: Apache-2.0 Imports: 4 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 {
	// FileLogging specifies whether logs should be additionally written to a file
	// FileLoggingJSON specifies whether log lines to files should be JSON formatted
	FileLoggingJSON bool
	// ConsoleLoggingJSON specifies whether log lines written to the console should be JSON formatted
	ConsoleLoggingJSON 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 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
}

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