logrusadapter

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const LoggerNameKey = "logger"

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

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

Adapter of logrus logger for logger.Logger.

This adapter guarantees support of stock logger's levels.

func New

func New(lgr *logrus.Entry) *Adapter

New creates new logging adapter using provided logrus.Entry.

Note, that by the contract of logger.Logger, adapter should not perform level-filtering internally - it is done by logger.Logger itself.

func (*Adapter) Flush

func (*Adapter) Flush() error

func (*Adapter) Log

func (a *Adapter) Log(level int, msg string, err error, fs ...fields.Field)

func (*Adapter) WithFields

func (a *Adapter) WithFields(fs ...fields.Field) logger.Adapter

func (*Adapter) WithName

func (a *Adapter) WithName(name string) logger.Adapter

WithName returns a logger adapter with the given name attached to it. As logrus does not support logger names, this adds LoggerNameKey field.

func (*Adapter) WithStackTrace

func (a *Adapter) WithStackTrace(_ string) logger.Adapter

Jump to

Keyboard shortcuts

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