log

package
v0.0.0-...-6a3170c Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugLevel = Level(logrus.DebugLevel)
)

Variables

This section is empty.

Functions

func AddHook

func AddHook(hook logrus.Hook)

func Errorf

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

func Fatal

func Fatal(args ...interface{})

func Fatalf

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

func Info

func Info(args ...interface{})

func Infof

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

func SetLevel

func SetLevel(level Level)

func Warningf

func Warningf(s string, args ...interface{})

func WithLogger

func WithLogger(ctx context.Context, logger *Logger) context.Context

WithLogger sets the logger in the context. The logger can be extracted with ExtractLogger. Reuse the logger to inherit the fields and hooks.

Types

type Config

type Config struct {
	Level        Level
	ReportCaller bool
}

type Fields

type Fields logrus.Fields

type Level

type Level logrus.Level

func ParseLevel

func ParseLevel(level string) (Level, error)

type Logger

type Logger struct {
	*logrus.Entry
}

func ExtractLogger

func ExtractLogger(ctx context.Context) *Logger

ExtractLogger returns the logger from the context. If no logger is found, a new logger is created. The context is updated with the new logger.

func New

func New(c *Config) *Logger

func (*Logger) WithContext

func (l *Logger) WithContext(ctx context.Context) *Logger

func (*Logger) WithField

func (l *Logger) WithField(key string, value interface{}) *Logger

func (*Logger) WithFields

func (l *Logger) WithFields(f Fields) *Logger

func (*Logger) WithOutput

func (l *Logger) WithOutput(out io.Writer) *Logger

Jump to

Keyboard shortcuts

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