logging

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "logging"

Variables

This section is empty.

Functions

func CreateCtx

func CreateCtx(ctx context.Context, logger *zap.Logger) context.Context

CreateCtx create context with logger

func GetLog

func GetLog(ctx context.Context) *zap.Logger

GetLog get log from context

从context中获取log, log会带上注入的字段

func L

func L() *zap.Logger

L global zap log

func S

func S() *zap.SugaredLogger

S global zap sugared log

Types

type ExtLog added in v0.2.4

type ExtLog func(logger *Logger)

type Logger

type Logger = zap.Logger

func New

func New(c config.Config) *Logger

New logger

func NewWithCfg

func NewWithCfg(cfg *log_config.Config) *Logger

type ModuleLogger added in v0.2.4

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

func GetGlobal added in v0.2.4

func GetGlobal(name string, fields ...zap.Field) *ModuleLogger

func ModuleLog added in v0.2.4

func ModuleLog(log *Logger, name string, fields ...zap.Field) *ModuleLogger

ModuleLog 命名的log

func (*ModuleLogger) Depth added in v0.2.4

func (t *ModuleLogger) Depth(depth ...int) *zap.Logger

func (*ModuleLogger) If added in v0.2.4

func (t *ModuleLogger) If(ok bool, logFn func(log *ModuleLogger))

func (*ModuleLogger) IfDebug added in v0.2.4

func (t *ModuleLogger) IfDebug(fn func(log *ModuleLogger))

func (*ModuleLogger) IfError added in v0.2.4

func (t *ModuleLogger) IfError(fn func(log *ModuleLogger))

func (*ModuleLogger) L added in v0.2.4

func (t *ModuleLogger) L() *zap.Logger

func (*ModuleLogger) S added in v0.2.4

func (t *ModuleLogger) S() *zap.SugaredLogger

func (*ModuleLogger) With added in v0.2.4

func (t *ModuleLogger) With(args typex.M) *zap.Logger

func (*ModuleLogger) WithErr added in v0.2.4

func (t *ModuleLogger) WithErr(err error, fields ...zap.Field) *zap.Logger

func (*ModuleLogger) WithFunc added in v0.2.4

func (t *ModuleLogger) WithFunc(fn interface{}) *zap.Logger

Directories

Path Synopsis
log_ext

Jump to

Keyboard shortcuts

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