logger

package
v1.10.5 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugLevel        = "debug"
	InfoLevel         = "info"
	WarnLevel         = "warn"
	ErrorLevel        = "error"
	FatalLevel        = "fatal"
	DefaultCallerSkip = 2
	LogLevelConfigKey = "log-level"
)
View Source
const DefaultLevel = InfoLevel

Variables

This section is empty.

Functions

func Debug

func Debug(fields ...interface{})

func Debugf

func Debugf(format string, args ...interface{})

func EnsureLoggerFromConfig

func EnsureLoggerFromConfig()

EnsureLoggerFromConfig is a convenience function to quickly create a new logger from the configuration. This requires that the configuration has already be bound from the flags. The function will FATAL if the logger could not be created.

func Error

func Error(fields ...interface{})

func Errorf

func Errorf(format string, args ...interface{})

func Fatal

func Fatal(fields ...interface{})

func Fatalf

func Fatalf(format string, args ...interface{})

func Flags

func Flags() *pflag.FlagSet

Flags is a convenience function to quickly add the log options as CLI flags Implements the cli.FlagProvider type

func Info

func Info(fields ...interface{})

func Infof

func Infof(format string, args ...interface{})

func NewLogger

func NewLogger(level string) error

func Warn

func Warn(fields ...interface{})

func Warnf

func Warnf(format string, args ...interface{})

Types

type Fields

type Fields map[string]interface{}

type Logger

type Logger interface {
	Debug(fields ...interface{})
	Debugf(format string, args ...interface{})
	Info(fields ...interface{})
	Infof(format string, args ...interface{})
	Warn(fields ...interface{})
	Warnf(format string, args ...interface{})
	Error(fields ...interface{})
	Errorf(format string, args ...interface{})
	Fatal(fields ...interface{})
	Fatalf(format string, args ...interface{})
	WithFields(keyValues Fields) Logger
	WithMetadata(ctx context.Context) Logger
}

func WithFields

func WithFields(keyValues Fields) Logger

func WithMetadata

func WithMetadata(ctx context.Context) Logger

Jump to

Keyboard shortcuts

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