logging

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package logging provides common logging infrastructure.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultLevel is the default log level.
	DefaultLevel = zap.NewAtomicLevelAt(zapcore.InfoLevel)
	// DefaultFormat is the default log format.
	DefaultFormat = FormatJSON
	// FormatConsole marks the console log format.
	FormatConsole = "console"
	// FormatJSON marks the JSON log format.
	FormatJSON = "json"
	// Logger is the default, system-wide logger.
	Logger *zap.Logger
)

Functions

func Configure

func Configure(level string, format string) error

Configure configures the default log "level" and the log "format".

func DumpRequestResponseInterceptor

func DumpRequestResponseInterceptor(logger *zap.Logger) grpc.UnaryServerInterceptor

DumpRequestResponseInterceptor returns a grpc.UnaryServerInterceptor that logs incoming requests and corresponding responses to 'logger'.

func HTTPMiddleware

func HTTPMiddleware(logger *zap.Logger, handler http.Handler) http.Handler

HTTPMiddleware installs a logging http.Handler that logs requests and selected aspects of responses to 'logger'.

func Interceptor

func Interceptor(logger *zap.Logger) grpc.UnaryServerInterceptor

Interceptor returns a grpc.UnaryServerInterceptor that logs incoming requests and associated tags to "logger".

func WithValuesFromContext

func WithValuesFromContext(ctx context.Context, logger *zap.Logger) *zap.Logger

WithValuesFromContext augments logger with relevant fields from ctx and returns the the resulting logger.

Types

This section is empty.

Jump to

Keyboard shortcuts

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