logger

package
v0.0.0-...-80d63af Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event interface {
	Ctx(ctx context.Context) Event
	Err(err error) Event
	Values(values ...any) Event
	Msg(msg string, args ...any)
}

type Impl

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

Impl is a struct that represents a logger

func NewLogger

func NewLogger(cfg *config.Config) *Impl

NewLogger creates a new logger

func Nop

func Nop() *Impl

Nop returns a no operation logger

func (*Impl) Dbg

func (l *Impl) Dbg() Event

Dbg returns a debug event

func (*Impl) Err

func (l *Impl) Err(err error) Event

Err returns an error event

func (*Impl) Fatalf

func (l *Impl) Fatalf(format string, v ...any)

Fatalf returns a fatal event with formatted message

func (*Impl) Ftl

func (l *Impl) Ftl() Event

Ftl returns a fatal event

func (*Impl) Inf

func (l *Impl) Inf() Event

Inf returns an info event

func (*Impl) Logger

func (l *Impl) Logger() zerolog.Logger

Logger returns the logger

func (*Impl) New

func (l *Impl) New(name string) Logger

New creates a new logger

func (*Impl) Printf

func (l *Impl) Printf(format string, v ...any)

Printf returns an event with formatted message

func (*Impl) Trc

func (l *Impl) Trc() Event

Trc returns a trace event

func (*Impl) Wrn

func (l *Impl) Wrn() Event

Wrn returns a warning event

type Logger

type Logger interface {
	New(name string) Logger
	Logger() zerolog.Logger

	Trc() Event
	Dbg() Event
	Inf() Event
	Wrn() Event
	Err(err error) Event
	Ftl() Event

	// goose
	Fatalf(format string, v ...any)
	Printf(format string, v ...any)
}

Logger is an interface that represents a logger

type ServiceEvent

type ServiceEvent struct {
	*zerolog.Event
}

ServiceEvent is a struct that represents a logger event

func (*ServiceEvent) Ctx

func (e *ServiceEvent) Ctx(ctx context.Context) Event

Ctx returns an event with context

func (*ServiceEvent) Err

func (e *ServiceEvent) Err(err error) Event

Err returns an event with error

func (*ServiceEvent) Msg

func (e *ServiceEvent) Msg(msg string, args ...any)

Msg returns a message

func (*ServiceEvent) Values

func (e *ServiceEvent) Values(values ...any) Event

Values returns an event with pair (key=value)

Jump to

Keyboard shortcuts

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