log

package
v3.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package log provides a 12-factor convenience wrapper around zap

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

func Debugf

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

func Debugln

func Debugln(args ...interface{})

func Debugw

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

func Error

func Error(args ...interface{})

func ErrorOnPanic

func ErrorOnPanic()

ErrorOnPanic logs error if func panics. Usage:

func someFunc() {
  defer log.ErrorOnPanic()
  ... // code that may panic()
}

func Errorf

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

func Errorln

func Errorln(args ...interface{})

func Errorw

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

func Fatal

func Fatal(args ...interface{})

func FatalOnPanic

func FatalOnPanic()

FatalOnPanic calls Fatal if func panics. Usage:

func someFunc() {
  defer log.FatalOnPanic()
  ... // code that may panic()
}

func Fatalf

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

func Fatalln

func Fatalln(args ...interface{})

func Fatalw

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

func Info

func Info(args ...interface{})

func Infof

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

func Infoln

func Infoln(args ...interface{})

func Infow

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

func L

func L() *zap.Logger

L returns the global logger

func Replace

func Replace(l *zap.Logger)

Replace allows you to replace the global logger. Example:

scoped := log.L().Named("worker").With(
  zap.String("key", "value"),
)
log.Replace(scoped)

func Silence

func Silence()

Silence silences log output, useful in tests.

func Sync

func Sync() error

Sync performs a final sync. Best added to you main function. Usage:

func main() {
  defer log.Sync()
  ...
}

func Warn

func Warn(args ...interface{})

func Warnf

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

func Warnln

func Warnln(args ...interface{})

func Warnw

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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