logger

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: Apache-2.0 Imports: 10 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

View Source
var C = From

Functions

func Set

func Set(ctx context.Context, logger Logger) context.Context

func SetDefault

func SetDefault(logger Logger)

Types

type Level added in v0.4.2

type Level = logrus.Level
const (
	// PanicLevel level, highest level of severity. Logs and then calls panic with the
	// message passed to Debug, Info, ...
	PanicLevel Level = iota
	// FatalLevel level. Logs and then calls `logger.Exit(1)`. It will exit even if the
	// logging level is set to Panic.
	FatalLevel
	// ErrorLevel level. Logs. Used for errors that should definitely be noted.
	// Commonly used for hooks to send errors to an error tracking service.
	ErrorLevel
	// WarnLevel level. Non-critical entries that deserve eyes.
	WarnLevel
	// InfoLevel level. General operational entries about what's going on inside the
	// application.
	InfoLevel
	// DebugLevel level. Usually only enabled when debugging. Very verbose logging.
	DebugLevel
	// TraceLevel level. Designates finer-grained informational events than the Debug.
	TraceLevel
)

type Logger

type Logger interface {
	WithContext(ctx context.Context) Logger

	WithReportCaller(b bool) Logger

	WithField(key string, value interface{}) Logger
	WithFields(kv ...interface{}) Logger
	WithError(err error) Logger

	SetLevel(level Level) Logger
	WriterLevel(level Level) *io.PipeWriter

	SetOutput(w io.Writer) Logger

	Tracef(format string, args ...interface{})
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Printf(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	Panicf(format string, args ...interface{})

	Trace(args ...interface{})
	Debug(args ...interface{})
	Info(args ...interface{})
	Print(args ...interface{})
	Warn(args ...interface{})
	Warning(args ...interface{})
	Error(args ...interface{})
	Fatal(args ...interface{})
	Panic(args ...interface{})

	Traceln(args ...interface{})
	Debugln(args ...interface{})
	Infoln(args ...interface{})
	Println(args ...interface{})
	Warnln(args ...interface{})
	Warningln(args ...interface{})
	Errorln(args ...interface{})
	Fatalln(args ...interface{})
	Panicln(args ...interface{})

	Logr() logr.Logger
	FieldLogger() logrus.FieldLogger
	Logger() *logrus.Logger

	Clone() Logger
}

func From

func From(ctx context.Context) Logger

func FromLogrus

func FromLogrus(fl logrus.Ext1FieldLogger) Logger

func New

func New() Logger

func StandardLogger

func StandardLogger() Logger

Jump to

Keyboard shortcuts

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