log

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: MIT Imports: 11 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultLog is default tsf logger
	DefaultLogger log.Logger  = NewLogger(WithTrace(true), WithPath(env.LogPath()), WithLevel(Level(env.LogLevel())))
	DefaultLog    *log.Helper = log.NewHelper(DefaultLogger)
)

Functions

func NewHelper

func NewHelper(l log.Logger) *log.Helper

NewHelper return tsf new logger helper

func NewLogger

func NewLogger(opts ...Option) log.Logger

NewLogger return tsf new logger

func Trace

func Trace() log.Valuer

Trace returns a traceid valuer.

Types

type Level

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

type Option

type Option func(t *options)

func WithLevel

func WithLevel(l Level) Option

func WithPath

func WithPath(path string) Option

func WithTrace

func WithTrace(enable bool) Option

func WithZap

func WithZap(logger *zap.Logger) Option

Jump to

Keyboard shortcuts

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