log

package
v0.0.0-...-505e429 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: MIT Imports: 10 Imported by: 0

README

the code under this dir is copy from github.com/go-kratos/kratos/log 100%.
why not directly import?

Documentation

Index

Constants

View Source
const LevelKey = "level"

Variables

View Source
var (
	DefaultTimestamp = TimeStamp(time.RFC3339)
	DefaultCaller    = Caller(4)
)
View Source
var DefaultLogger = NewStdLogger(log.Writer())
View Source
var DefaultMessageKey = "msg"

Functions

func Debugf

func Debugf(format string, a ...interface{})

func Errorf

func Errorf(format string, a ...interface{})

func Info

func Info(a ...interface{})

func Infof

func Infof(format string, a ...interface{})

func SetLogger

func SetLogger(logger Logger)

Types

type Helper

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

func NewHelper

func NewHelper(logger Logger, opts ...Option) *Helper

func (*Helper) Debug

func (h *Helper) Debug(a ...interface{})

func (*Helper) Debugf

func (h *Helper) Debugf(format string, a ...interface{})

func (*Helper) Debugw

func (h *Helper) Debugw(a ...interface{})

func (*Helper) Errorf

func (h *Helper) Errorf(format string, a ...interface{})

func (*Helper) Info

func (h *Helper) Info(a ...interface{})

func (*Helper) Infof

func (h *Helper) Infof(format string, a ...interface{})

func (*Helper) Infow

func (h *Helper) Infow(a ...interface{})

type Level

type Level int8
const (
	LevelDebug Level = iota - 1
	LevelInfo
	LevelWarn
	LevelError
	LevelFatal
)

func ParseLevel

func ParseLevel(s string) Level

func (Level) String

func (l Level) String() string

type Logger

type Logger interface {
	Log(level Level, keyValues ...interface{}) error
}

func NewStdLogger

func NewStdLogger(w io.Writer) Logger

func With

func With(l Logger, kv ...interface{}) Logger

type Option

type Option func(helper *Helper)

type Valuer

type Valuer func(ctx context.Context) interface{}

func Caller

func Caller(depth int) Valuer

func TimeStamp

func TimeStamp(layout string) Valuer

Jump to

Keyboard shortcuts

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