log

package
v0.0.0-...-2406947 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: Apache-2.0 Imports: 4 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fields

type Fields map[string]interface{}

func (Fields) String

func (fields Fields) String() string

func (Fields) WithFields

func (fields Fields) WithFields(newFields Fields) Fields

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
)

These are the different logging levels. You can set the logging level to log on your instance of logger, obtained with `logrus.New()`.

type Loggable

type Loggable interface {
	Log() Logger
}

type Logger

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

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

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

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

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

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

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

	Panic(args ...interface{})
	Panicf(format string, args ...interface{})

	WithPrefix(prefix string) Logger
	Prefix() string

	WithFields(fields Fields) Logger
	Fields() Fields

	SetLevel(level Level)
}

Logger interface used as base logger throughout the library.

func AddFieldsFrom

func AddFieldsFrom(logger Logger, values ...interface{}) Logger

type LogrusLogger

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

func NewDefaultLogrusLogger

func NewDefaultLogrusLogger() *LogrusLogger

func NewLogrusLogger

func NewLogrusLogger(logrus logrus.Ext1FieldLogger, prefix string, fields Fields) *LogrusLogger

func (*LogrusLogger) Debug

func (l *LogrusLogger) Debug(args ...interface{})

func (*LogrusLogger) Debugf

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

func (*LogrusLogger) Error

func (l *LogrusLogger) Error(args ...interface{})

func (*LogrusLogger) Errorf

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

func (*LogrusLogger) Fatal

func (l *LogrusLogger) Fatal(args ...interface{})

func (*LogrusLogger) Fatalf

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

func (*LogrusLogger) Fields

func (l *LogrusLogger) Fields() Fields

func (*LogrusLogger) Info

func (l *LogrusLogger) Info(args ...interface{})

func (*LogrusLogger) Infof

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

func (*LogrusLogger) Panic

func (l *LogrusLogger) Panic(args ...interface{})

func (*LogrusLogger) Panicf

func (l *LogrusLogger) Panicf(format string, args ...interface{})

func (*LogrusLogger) Prefix

func (l *LogrusLogger) Prefix() string

func (*LogrusLogger) Print

func (l *LogrusLogger) Print(args ...interface{})

func (*LogrusLogger) Printf

func (l *LogrusLogger) Printf(format string, args ...interface{})

func (*LogrusLogger) SetLevel

func (l *LogrusLogger) SetLevel(level Level)

func (*LogrusLogger) Trace

func (l *LogrusLogger) Trace(args ...interface{})

func (*LogrusLogger) Tracef

func (l *LogrusLogger) Tracef(format string, args ...interface{})

func (*LogrusLogger) Warn

func (l *LogrusLogger) Warn(args ...interface{})

func (*LogrusLogger) Warnf

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

func (*LogrusLogger) WithFields

func (l *LogrusLogger) WithFields(fields Fields) Logger

func (*LogrusLogger) WithPrefix

func (l *LogrusLogger) WithPrefix(prefix string) Logger

Jump to

Keyboard shortcuts

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