logger

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ContextKey           = contextKey{}
	ErrNoLoggerInContext = errors.New("no logger in context")
)

Functions

func Init

func Init(cfg Logging) (err error)

Init initializes a rs/zerolog logger from user config

Types

type Loggable

type Loggable interface {
	SetLogger(*Logger)
}

Loggable indicates the implement supports logging

type Logger

type Logger struct {
	*zerolog.Logger
	// contains filtered or unexported fields
}

Logger is wrapper for rs/zerolog logger with module, it is singleton.

func Fetch

func Fetch(ctx context.Context, name string) *Logger

func GetLogger

func GetLogger(scope ...string) *Logger

GetLogger return logger with a scope

func (Logger) Module added in v0.2.0

func (l Logger) Module() string

func (*Logger) Named

func (l *Logger) Named(name string) *Logger

type Logging

type Logging struct {
	Env   string
	Level string
}

Logging is the config info

Jump to

Keyboard shortcuts

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