Back to godoc.org

Package logging

v0.0.0-...-9649366
Latest Go to latest

The highest tagged major version is .

Published: Nov 21, 2019 | License: Apache-2.0 | Module: github.com/chronosphereiox/m3

Index

func NewContext

func NewContext(
	ctx context.Context,
	instrumentOpts instrument.Options,
	fields ...zapcore.Field,
) context.Context

NewContext returns a context has a zap logger with the extra fields added.

func NewContextWithGeneratedID

func NewContextWithGeneratedID(
	ctx context.Context,
	instrumentOpts instrument.Options,
) context.Context

NewContextWithGeneratedID returns a context with a generated id with a zap logger and an id field.

func NewContextWithID

func NewContextWithID(
	ctx context.Context,
	id string,
	instrumentOpts instrument.Options,
) context.Context

NewContextWithID returns a context which has a zap logger and an id field.

func ReadContextID

func ReadContextID(ctx context.Context) string

ReadContextID returns the context's id or "undefined".

func WithContext

func WithContext(ctx context.Context, instrumentOpts instrument.Options) *zap.Logger

WithContext returns a zap logger with as much context as possible.

func WithPanicErrorResponder

func WithPanicErrorResponder(
	next http.Handler,
	instrumentOpts instrument.Options,
) http.Handler

WithPanicErrorResponder wraps around the given handler, providing panic recovery and logging.

func WithResponseTimeAndPanicErrorLogging

func WithResponseTimeAndPanicErrorLogging(
	next http.Handler,
	instrumentOpts instrument.Options,
) http.Handler

WithResponseTimeAndPanicErrorLogging wraps around the given handler, providing panic recovery and response time logging.

func WithResponseTimeAndPanicErrorLoggingFunc

func WithResponseTimeAndPanicErrorLoggingFunc(
	next func(w http.ResponseWriter, r *http.Request),
	instrumentOpts instrument.Options,
) http.Handler

WithResponseTimeAndPanicErrorLoggingFunc wraps around the http request handler function, providing panic recovery and response time logging.

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

Jump to identifier

Keyboard shortcuts

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