zapctx

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2019 License: MIT Imports: 8 Imported by: 0

README

zapctx

Helper for using Zap within a go context

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyLoggerToContext

func CopyLoggerToContext(src, dst context.Context) context.Context

CopyLoggerToContext copies the logger from one context to another.

func HTTPLevelChangeFunc

func HTTPLevelChangeFunc(w http.ResponseWriter, r *http.Request)

HTTPLevelChangeFunc allows you to host an endpoint that will change the logging level on the default logger

func Init

func Init(appName string) *zap.Logger

func InitTest

func InitTest(t testing.TB) *zap.Logger

func L

func L() *zap.Logger

L returns the global logger for this instance

func Logger

func Logger(ctx context.Context) *zap.Logger

Logger returns the zap logger from the given context

func ReadLoggingConfig

func ReadLoggingConfig()

func WithDefaultLogger

func WithDefaultLogger(ctx context.Context) context.Context

WithDefaultLogger will put the specified logger in the returned context.

func WithFields

func WithFields(ctx context.Context, fields ...zapcore.Field) context.Context

WithFields adds all of the given fields to the context logger.

func WithLogger

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

WithLogger will put the specified logger in the returned context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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