logger

package
v1.20.6 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: Apache-2.0, Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLevel

func GetLevel(core zapcore.Core) zapcore.Level

func SetLogLevel

func SetLogLevel(lvl Level)

SetLogLevel will set the logger log level

func SetLogger

func SetLogger(externalLog interface{})

SetLogger changes default logger on external

logrusLogger := logrus.New() SetLogger(logrusLogger)

Types

type Fields

type Fields map[string]interface{}

type Level

type Level uint32

Level type

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 LogEntry

type LogEntry struct {
	Logger
	Level Level
}
var (
	Log LogEntry
)

func NewLogrus

func NewLogrus(logger *logrus.Logger) LogEntry

func NewNoopLogger

func NewNoopLogger() LogEntry

func NewZap

func NewZap(logger *zap.Logger) LogEntry

func NewZero

func NewZero(logger *zerolog.Logger) LogEntry

type Logger

type Logger interface {
	Debug(args ...interface{})
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})
	Panic(args ...interface{})
	Fatal(args ...interface{})

	Debugf(template string, args ...interface{})
	Infof(template string, args ...interface{})
	Warnf(template string, args ...interface{})
	Errorf(template string, args ...interface{})
	Panicf(template string, args ...interface{})
	Fatalf(template string, args ...interface{})

	Trace(args ...interface{})
	Tracef(format string, args ...interface{})

	Print(args ...interface{})
	Println(args ...interface{})
	Printf(format string, args ...interface{})

	WithFields(keyValues Fields) LogEntry
}

type NoopLogger

type NoopLogger struct{}

func (*NoopLogger) Debug

func (logger *NoopLogger) Debug(args ...interface{})

func (*NoopLogger) Debugf

func (logger *NoopLogger) Debugf(template string, args ...interface{})

func (*NoopLogger) Error

func (logger *NoopLogger) Error(args ...interface{})

func (*NoopLogger) Errorf

func (logger *NoopLogger) Errorf(template string, args ...interface{})

func (*NoopLogger) Fatal

func (logger *NoopLogger) Fatal(args ...interface{})

func (*NoopLogger) Fatalf

func (logger *NoopLogger) Fatalf(template string, args ...interface{})

func (*NoopLogger) Info

func (logger *NoopLogger) Info(args ...interface{})

func (*NoopLogger) Infof

func (logger *NoopLogger) Infof(template string, args ...interface{})

func (*NoopLogger) Panic

func (logger *NoopLogger) Panic(args ...interface{})

func (*NoopLogger) Panicf

func (logger *NoopLogger) Panicf(template string, args ...interface{})

func (*NoopLogger) Print

func (logger *NoopLogger) Print(args ...interface{})

func (*NoopLogger) Printf

func (logger *NoopLogger) Printf(format string, args ...interface{})

func (*NoopLogger) Println

func (logger *NoopLogger) Println(args ...interface{})

func (*NoopLogger) Trace

func (logger *NoopLogger) Trace(args ...interface{})

func (*NoopLogger) Tracef

func (logger *NoopLogger) Tracef(format string, args ...interface{})

func (*NoopLogger) Warn

func (logger *NoopLogger) Warn(args ...interface{})

func (*NoopLogger) Warnf

func (logger *NoopLogger) Warnf(template string, args ...interface{})

func (*NoopLogger) WithFields

func (logger *NoopLogger) WithFields(keyValues Fields) LogEntry

Jump to

Keyboard shortcuts

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