Back to godoc.org
github.com/clevergo/log/zapadapter

Package zapadapter

v0.3.0
Latest Go to latest

The highest tagged major version is .

Published: Mar 8, 2020 | License: BSD-3-Clause | Module: github.com/clevergo/log/zapadapter

Index

Examples

type Logger

type Logger struct {
	*zap.SugaredLogger
}

Logger is a zap logger adapter that implements logger interface.

func New

func New(sugaredLogger *zap.SugaredLogger) *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")

func (*Logger) Debug

func (l *Logger) Debug(args ...interface{})

Debug implements Logger.Debug.

func (*Logger) Debugf

func (l *Logger) Debugf(format string, args ...interface{})

Debugf implements Logger.Debugf.

func (*Logger) Debugln

func (l *Logger) Debugln(args ...interface{})

Debugln implements Logger.Debugln.

func (*Logger) Error

func (l *Logger) Error(args ...interface{})

Error implements Logger.Error.

func (*Logger) Errorf

func (l *Logger) Errorf(format string, args ...interface{})

Errorf implements Logger.Errorf.

func (*Logger) Errorln

func (l *Logger) Errorln(args ...interface{})

Errorln implements Logger.Errorln.

func (*Logger) Fatal

func (l *Logger) Fatal(args ...interface{})

Fatal implements Logger.Fatal.

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, args ...interface{})

Fatalf implements Logger.Fatalf.

func (*Logger) Fatalln

func (l *Logger) Fatalln(args ...interface{})

Fatalln implements Logger.Fatalln.

func (*Logger) Info

func (l *Logger) Info(args ...interface{})

Info implements Logger.Info.

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...interface{})

Infof implements Logger.Infof.

func (*Logger) Infoln

func (l *Logger) Infoln(args ...interface{})

Infoln implements Logger.Infoln.

func (*Logger) Warn

func (l *Logger) Warn(args ...interface{})

Warn implements Logger.Warn.

func (*Logger) Warnf

func (l *Logger) Warnf(format string, args ...interface{})

Warnf implements Logger.Warnf.

func (*Logger) Warnln

func (l *Logger) Warnln(args ...interface{})

Warnln implements Logger.Warnln.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

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