logger

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT, Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultV2 = New(logi.GetNoCallerLogger().Logger, &logger.Config{
		SlowThreshold: 100 * time.Millisecond,
		LogLevel:      logger.Warn,
		Colorful:      true,
	})
)

Functions

func New

func New(loger *zap.Logger, conf *logger.Config) logger.Interface

func SetTranceId added in v0.0.40

func SetTranceId(ctx context.Context, traceId string) context.Context

func TraceId added in v0.0.40

func TraceId(ctx context.Context) string

Types

type Config

type Config struct {
	SlowThreshold time.Duration
	Colorful      bool
	LogLevel      zapcore.Level
}

type Logger

type Logger struct {
	*zap.Logger
	*logger.Config
}

func (*Logger) Error

func (l *Logger) Error(ctx context.Context, msg string, data ...interface{})

Error print error messages

func (*Logger) Info

func (l *Logger) Info(ctx context.Context, msg string, data ...interface{})

Info print info

func (*Logger) LogMode

func (l *Logger) LogMode(level logger.LogLevel) logger.Interface

LogMode log mode

func (*Logger) Trace

func (l *Logger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)

Trace print sql message 只有这里的context不是background,看了代码,也没用

func (*Logger) Warn

func (l *Logger) Warn(ctx context.Context, msg string, data ...interface{})

Warn print warn messages

Jump to

Keyboard shortcuts

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