Back to godoc.org
github.com/clevergo/log-zap

Package zapadapter

v0.1.0
Latest Go to latest

The latest major version is .

Published: Feb 28, 2020 | License: BSD-3-Clause | Module: github.com/clevergo/log-zap

Index

Examples

func New

func New(sugaredLogger *zap.SugaredLogger) log.Logger

New returns a logger.

Example

Code:

zapLogger, err := zap.NewDevelopment(zap.AddCallerSkip(1))
if err != nil {
	panic(err)
}
logger := New(zapLogger.Sugar())
logger.Debug("debug")
logger.Debugf("debugf")
logger.Debugln("debugln")

logger.Info("info")
logger.Infof("infof")
logger.Infoln("infoln")

logger.Warn("warn")
logger.Warnf("warnf")
logger.Warnln("warnln")

logger.Error("error")
logger.Errorf("errorf")
logger.Errorln("errorln")

//logger.Fatal("fatal")
//logger.Fatalf("fatalf")
//logger.Fatalln("fatalln")
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier