logger

package
v0.0.0-...-0490640 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package logger is intended to abstract our concrete logging backend, to not litter all the code base with "sirupsen/logrus" imports; also makes it easier to eventually switch out the logging library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseZapEncoding

func ParseZapEncoding(enc string) string

ParseZapEncoding takes a string and returns a valid Zap encoding, defaulting to "console".

func ParseZapLevel

func ParseZapLevel(level string) zapcore.Level

ParseZapLevel takes a string and returns a zap.Level. It the level is unrecognized, it returns the default level.

func WrapZapGRPC

func WrapZapGRPC(l *zap.Logger) grpclog.LoggerV2

Types

type KV

type KV = logrus.Fields

KV is the type for field literals. These are key/value pairs, hence "KV". We declare it as an alias to the logrus.Fields type which is a type defined as map[string]interface{}.

type Logger

type Logger interface {
	// grpclog uses this to determine log levels
	V(i int) bool

	// NewEntry returns a new logrus.Entry to be used with grpc_logrus middleware
	NewEntry() *logrus.Entry

	logrus.FieldLogger
}

Logger is the interface provided by our logger abstraction

func NewLogger

func NewLogger(format, level string) (Logger, error)

NewLogger initializes a new logger with the passed format and level

func NewLoggerWithOut

func NewLoggerWithOut(format, level string, out io.Writer) (Logger, error)

func NewTestLogger

func NewTestLogger() Logger

NewTestLogger returns a logger that discards all output -- to keep test output undisturbed.

Jump to

Keyboard shortcuts

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