log

package
v0.0.0-...-4c38643 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var L = MustNewLogger("", "", "", true, 0)

Functions

func SetGlobalLogger

func SetGlobalLogger(helper *Logger)

SetGlobalLogger set the global default logger

Types

type Logger

type Logger struct {
	// 为什么不直接把zap.Logger放出来,而是自己再对其Debug等函数再包装?
	// 主要是因为 kratos 切换到zap后,都是同一个堆栈调用的问题
	*zap.Logger
	// contains filtered or unexported fields
}

func MustNewLogger

func MustNewLogger(serviceId, serviceName, serviceVersion string, development bool, callerSkip int) *Logger

MustNewLogger new zap Logger

func Trace

func Trace(ctx context.Context) *Logger

Trace creates a child logger and adds trace&span id to it. Fields added to the child don't affect the parent, and vice versa.

func With

func With(logger *Logger, fields ...zap.Field) *Logger

With creates a child logger and adds structured context to it. Fields added to the child don't affect the parent, and vice versa.

func (*Logger) Log

func (l *Logger) Log(level v2.Level, keyvals ...interface{}) error

Log is kratos log wrapper

func (*Logger) Trace

func (l *Logger) Trace(ctx context.Context) *Logger

Jump to

Keyboard shortcuts

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