logger

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(logLevel string, logFormat LogFormat, opts ...Option) (*zerolog.Logger, error)

NewLogger returns a zerolog.Logger

Types

type LogFormat

type LogFormat string
const (
	JSONFormat    LogFormat = "json"
	ConsoleFormat LogFormat = "console"
)

func (LogFormat) String

func (logFormat LogFormat) String() string

type Option

type Option interface {
	Apply(zerolog.Logger) zerolog.Logger
}

An Option configures a Logger

func WithFields

func WithFields(fields map[string]interface{}) Option

func WithStr

func WithStr(key, value string) Option

type OptionFunc

type OptionFunc func(zerolog.Logger) zerolog.Logger

OptionFunc is a function that configures a zerolog.Logger

func (OptionFunc) Apply

func (f OptionFunc) Apply(engine zerolog.Logger) zerolog.Logger

Apply is a function that set value to zerolog.Logger

Jump to

Keyboard shortcuts

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