log

package
v0.8.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithLoggerContext

func WithLoggerContext(ctx context.Context, logger Logger) context.Context

WithLoggerContext returns a new context with a set logger

Types

type Logger

type Logger interface {
	// Debugf uses fmt.Sprintf to log a templated message.
	Debugf(template string, args ...interface{})

	// Infof uses fmt.Sprintf to log a templated message.
	Infof(template string, args ...interface{})

	// Warnf uses fmt.Sprintf to log a templated message.
	Warnf(template string, args ...interface{})

	// Errorf uses fmt.Sprintf to log a templated message.
	Errorf(template string, args ...interface{})

	With(args ...interface{}) Logger

	WithErr(err error) Logger

	Named(name string) Logger
}

Logger is an interface for logging

func From

func From(ctx context.Context) Logger

From extracts a logger from the supplied context, or returns a NopLogger if none is found.

func NopLogger

func NopLogger() Logger

NopLogger constructs a nop logger

func TestLogger

func TestLogger(t *testing.T) Logger

TestLogger returns a logger for tests

func Wrap

func Wrap(z *zap.SugaredLogger) Logger

Wrap zap.SugaredLogger as Logger interface

Jump to

Keyboard shortcuts

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