logging

package
v0.11.14 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComponentLevels

func ComponentLevels() map[string]zerolog.Level

ComponentLevels returns a _copy_ of the currently configured component level map

func ConfigureDefaultLogging

func ConfigureDefaultLogging()

func SetComponentLevel

func SetComponentLevel(component string, children bool, level zerolog.Level)

SetComponentLevel changes the log level for a given component. If children is true, it will also change the log level for any child components that have been customized (by deleting that customization so that they inherit the log level from their parent).

Types

type LeveledLogger

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

LeveledLogger implements the interface of the same name from github.com/hashicorp/go-retryablehttp

func Leveled

func Leveled(l *Logger) LeveledLogger

Leveled returns a LeveledLogger wrapper for the given Logger

func (LeveledLogger) Debug

func (l LeveledLogger) Debug(msg string, keysAndValues ...interface{})

func (LeveledLogger) Error

func (l LeveledLogger) Error(msg string, keysAndValues ...interface{})

func (LeveledLogger) Info

func (l LeveledLogger) Info(msg string, keysAndValues ...interface{})

func (LeveledLogger) Warn

func (l LeveledLogger) Warn(msg string, keysAndValues ...interface{})

type Logger

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

Logger exists to wrap a replaceable zerolog.Logger so levels can be changed dynamically

func GetLogger

func GetLogger(component string) *Logger

GetLogger creates a logger for the given component name. Hierarchies in components should be represented with `/` characters in their name.

func GetLoggerWith

func GetLoggerWith(component string, with func(zerolog.Context) zerolog.Context) *Logger

GetLoggerWith creates a logger for the given component name and custom context configuration function. Hierarchies in components should be represented with `/` characters in their name.

func (*Logger) Current

func (l *Logger) Current() zerolog.Logger

func (*Logger) Debug

func (l *Logger) Debug() *zerolog.Event

func (*Logger) Err

func (l *Logger) Err(err error) *zerolog.Event

func (*Logger) Error

func (l *Logger) Error() *zerolog.Event

func (*Logger) Fatal

func (l *Logger) Fatal() *zerolog.Event

func (*Logger) Info

func (l *Logger) Info() *zerolog.Event

func (*Logger) Level

func (l *Logger) Level(level zerolog.Level) *Logger

func (*Logger) Trace

func (l *Logger) Trace() *zerolog.Event

func (*Logger) Warn

func (l *Logger) Warn() *zerolog.Event

func (*Logger) With

func (l *Logger) With(with func(zerolog.Context) zerolog.Context) *Logger

func (*Logger) WithLevel

func (l *Logger) WithLevel(level zerolog.Level) *zerolog.Event

func (*Logger) Write

func (l *Logger) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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