logger

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: BSD-3-Clause Imports: 7 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Default

func Default() *zap.Logger

Default the default log instance

func SetContextLogger

func SetContextLogger(ctx context.Context, log StdLogger) context.Context

SetContextLogger context with tags logger

Types

type StdLogger

type StdLogger interface {
	// With with any map data, the value of key must be string, int ... basic value
	With(m ...zap.Field) *zap.Logger
	// Debug print the debug log if the len(args) is 0, the args will be ignored
	Debug(msg string, fields ...zap.Field)
	Info(msg string, fields ...zap.Field)
	Warn(msg string, fields ...zap.Field)
	Error(msg string, fields ...zap.Field)
	Fatal(msg string, fields ...zap.Field)
}

StdLogger the standard logger

func Action

func Action(action string) StdLogger

Action set action filed for logger

func GetContextLogger

func GetContextLogger(ctx context.Context) StdLogger

GetLogger extract logger from context

func With

func With(m ...zap.Field) StdLogger

With with any map data, the value of key must be string, int ... basic value

func WithContext

func WithContext(ctx context.Context) StdLogger

WithContext

func WithTags

func WithTags(m map[string]string) StdLogger

WithTags with map string string tags more effective

Jump to

Keyboard shortcuts

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