logger

package module
v2.0.0-...-eae46c3 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

README

Logger

Installation

go get github.com/tpm-common/gommon/logger/v2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("logger not found")

Functions

func IntoContext

func IntoContext(ctx context.Context, logger Logger) context.Context

Types

type Logger

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

func FromContext

func FromContext(ctx context.Context) (Logger, error)

func New

func New(opts ...Opt) Logger

func (Logger) Enabled

func (l Logger) Enabled() bool

func (Logger) Error

func (l Logger) Error(err error, msg string, keysAndValues ...any)

func (Logger) Info

func (l Logger) Info(msg string, keysAndValues ...any)

func (Logger) WithCallDepth

func (l Logger) WithCallDepth(depth int) Logger

func (Logger) WithFields

func (l Logger) WithFields(keysAndValues ...any) Logger

func (Logger) WithName

func (l Logger) WithName(name string) Logger

func (Logger) WithVerbosity

func (l Logger) WithVerbosity(level int) Logger

type Opt

type Opt func(opt *Option)

func WithCaller

func WithCaller() Opt

func WithFields added in v2.1.0

func WithFields(keysAndValues ...any) Opt

func WithTimestamp

func WithTimestamp() Opt

func WithWriters added in v2.1.0

func WithWriters(w ...io.Writer) Opt

type Option

type Option struct {
	Writers       []io.Writer
	KeysAndValues []any
	ZerologCtxFns []func(ztx zerolog.Context) zerolog.Context
}

Jump to

Keyboard shortcuts

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