ctxlog

package
v0.0.0-...-b19b447 Latest Latest
Warning

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

Go to latest
Published: May 11, 2017 License: MIT Imports: 3 Imported by: 38

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// G is a shorcut for GetLogger
	G = GetLogger
	// S is a shortcut for GetSugaredLogger
	S = GetSugaredLogger

	// TraceBitLevelEnabler controls enabled log level for requests with TraceBit
	// It's set to DebugLevel by default
	TraceBitLevelEnabler = zap.NewAtomicLevel()
)

Functions

func GetLogger

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

GetLogger either returns an attached Logger from the context or global logger if nothing is attached

func GetSugaredLogger

func GetSugaredLogger(ctx context.Context) *zap.SugaredLogger

GetSugaredLogger either returns an attached SugaredLogger from the context or global sugared logger if nothing is attached

func WithLogger

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

WithLogger attaches logger to a given context. Later the logger can be obtained by GetLogger

func WithTraceBitLogger

func WithTraceBitLogger(ctx context.Context) context.Context

WithTraceBitLogger attaches TraceBitLogger based on a logger from context

Types

This section is empty.

Jump to

Keyboard shortcuts

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