logger

package
v0.0.11 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JsonRawLog added in v0.0.6

func JsonRawLog(msg, level string, err error)

func NewLogrus added in v0.0.2

func NewLogrus(cfg loggerconfig.Configurator, output Outputer) (logger *Logrus, cancel CancelFunc, err error)

NewLogrus creates a new Logrus logger instance for the given output.

Types

type CancelFunc

type CancelFunc = func()

func NewOutput added in v0.0.2

func NewOutput(cfg loggerconfig.Configurator) (out *os.File, cancel CancelFunc, err error)

NewOutput opens the target output file and provides cancelFunc for close it. If the output is passed as empty string, then the output will be used from config. NOTE: Must be called just once per unique output, or you will see the error while closing an output that a file already closed. This happens due to two outputs refers to the same file pointer.

type Fields

type Fields = map[string]any

type Logger

type Logger interface {
	DebugMsg(ctx context.Context, msg string, fields Fields)
	InfoMsg(ctx context.Context, msg string, fields Fields)
	WarningMsg(ctx context.Context, msg string, fields Fields)
	ErrorMsg(ctx context.Context, msg string, fields Fields)
	FatalMsg(ctx context.Context, msg string, fields Fields)
	PanicMsg(ctx context.Context, msg string, fields Fields)
	LogMsg(ctx context.Context, msg, level string, fields Fields)

	Debug(ctx context.Context, err error, fields Fields) error
	Info(ctx context.Context, err error, fields Fields) error
	Warning(ctx context.Context, err error, fields Fields) error
	Error(ctx context.Context, err error, fields Fields) error
	Fatal(ctx context.Context, err error, fields Fields) error
	Panic(ctx context.Context, err error, fields Fields) error
	Log(ctx context.Context, err error, level string, fields Fields)
}

type Logrus added in v0.0.2

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

func (*Logrus) Debug added in v0.0.2

func (l *Logrus) Debug(ctx context.Context, err error, fields Fields) error

func (*Logrus) DebugMsg added in v0.0.2

func (l *Logrus) DebugMsg(ctx context.Context, msg string, fields Fields)

func (*Logrus) Error added in v0.0.2

func (l *Logrus) Error(ctx context.Context, err error, fields Fields) error

func (*Logrus) ErrorMsg added in v0.0.2

func (l *Logrus) ErrorMsg(ctx context.Context, msg string, fields Fields)

func (*Logrus) Fatal added in v0.0.2

func (l *Logrus) Fatal(ctx context.Context, err error, fields Fields) error

func (*Logrus) FatalMsg added in v0.0.2

func (l *Logrus) FatalMsg(ctx context.Context, msg string, fields Fields)

func (*Logrus) Info added in v0.0.2

func (l *Logrus) Info(ctx context.Context, err error, fields Fields) error

func (*Logrus) InfoMsg added in v0.0.2

func (l *Logrus) InfoMsg(ctx context.Context, msg string, fields Fields)

func (*Logrus) Log added in v0.0.8

func (l *Logrus) Log(ctx context.Context, err error, level string, fields Fields)

func (*Logrus) LogMsg added in v0.0.8

func (l *Logrus) LogMsg(ctx context.Context, msg, level string, fields Fields)

func (*Logrus) Panic added in v0.0.2

func (l *Logrus) Panic(ctx context.Context, err error, fields Fields) error

func (*Logrus) PanicMsg added in v0.0.2

func (l *Logrus) PanicMsg(ctx context.Context, msg string, fields Fields)

func (*Logrus) Warning added in v0.0.2

func (l *Logrus) Warning(ctx context.Context, err error, fields Fields) error

func (*Logrus) WarningMsg added in v0.0.2

func (l *Logrus) WarningMsg(ctx context.Context, msg string, fields Fields)

type Outputer

type Outputer interface {
	io.Closer
	io.Writer
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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