logger

package
v0.0.0-...-297d307 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package logger 对zap做了一层简单的包装,提供了基本的重定向到日志,常用的函数封装等 TODO:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, fields ...zapcore.Field)

Debug logger.Debug

func Debugf

func Debugf(template string, args ...interface{})

Debugf debugf

func Debugw

func Debugw(msg string, keyAndValues ...interface{})

Debugw sugar.Debugw

func Duration

func Duration(key string, duration time.Duration) zap.Field

Duration zap duration

func Err

func Err(err error) zap.Field

Err error string

func Error

func Error(msg string, fields ...zapcore.Field)

Error logger.Error

func Errorf

func Errorf(template string, args ...interface{})

Errorf sugar.Errorf

func Errorw

func Errorw(msg string, keyAndValues ...interface{})

Errorw sugar.Errorw

func Fatal

func Fatal(msg string, fields ...zapcore.Field)

Fatal logger.Fatal

func Info

func Info(msg string, fields ...zapcore.Field)

Info logger.Info

func Infof

func Infof(template string, args ...interface{})

Infof sugar.Infof

func Infow

func Infow(msg string, keyAndValues ...interface{})

Infow sugar

func Init

func Init(ctx context.Context, debug bool, opt Option) error

Init zap

func InitDebug

func InitDebug()

InitDebug is a utility to be used in tests

func Int

func Int(k string, v int) zap.Field

Int int

func Logger

func Logger() *zap.Logger

Logger wraps logger

func RequestID

func RequestID(ctx context.Context) zap.Field

RequestID requestID kv

func String

func String(k, v string) zap.Field

String zap string

func Sugar

func Sugar() *zap.SugaredLogger

Sugar wraps sugar

func Warn

func Warn(msg string, fields ...zapcore.Field)

Warn logger.Warn

func Warnw

func Warnw(msg string, keyAndValues ...interface{})

Warnw sugar.Warn

Types

type Option

type Option struct {
}

Option for zap logger

type Options

type Options struct {
	Level    string
	Encoding string `default:"console"`
}

Jump to

Keyboard shortcuts

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