log

package
v0.0.0-...-7a54f7c Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEBUG = iota + 1
	INFO
	WARNING
	Error
	FATAL
)

Variables

View Source
var DefaultLogger = &context{
	keyvals: []string{},
	v:       INFO,
	log:     zerolog.New(os.Stderr).With().Timestamp().CallerWithSkipFrameCount(4).Logger()}
View Source
var ErrKeyValNoCorrespondence = errors.New("err:key and value isn't correspondence")

Functions

This section is empty.

Types

type Logger

type Logger interface {
	V(v int) bool                        // V is level's
	With() Logger                        // With is create a new logger
	WithKeyvals(keyvals ...string) error // WithKeyvals is append prefix
	Info(msg string)                     // INFO log
	Infof(msg string, a ...interface{})  // INFO log
	Error(msg string)                    // Error Log
	Errorf(msg string, a ...interface{}) // Error Log
}

Logger is a log interface

func NewLogger

func NewLogger(opts ...LoggerOption) (Logger, error)

NewLogger is new a logger logger is a log interface

type LoggerOption

type LoggerOption func(c *context)

func WithCaller

func WithCaller() LoggerOption

func WithKeyvals

func WithKeyvals(keyvals ...string) LoggerOption

func WithTime

func WithTime() LoggerOption

Jump to

Keyboard shortcuts

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