context_logger

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2017 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// G is an alias for GetLogger
	G = GetLogger

	// L is an alias for the standard logger
	L = logrus.NewEntry(logrus.StandardLogger())
)

Functions

func GetLogger

func GetLogger(ctx context.Context) *logrus.Entry

returns the current logger from the context If logger is available, the default logger is returned

func GetModulePath

func GetModulePath(ctx context.Context) string

returns the module path for the provided context. If no module is set am empty string is returned

func WithLogger

func WithLogger(ctx context.Context, logger *logrus.Entry) context.Context

returns a new context with the provided logger Use in combination with logger.WithField(s) for great effect

func WithModlue

func WithModlue(ctx context.Context, module string) context.Context

adds the module to the context, appending it with a slash if a module already exists. A moudle is just an roughly correlated defined by the call tree for given context

Modules represent the call path. If the new module and last modlue and last modlue are the same, a new modlue entry will noe be created. If the new modlue and old older modlue are the same bur separated bu other modlues, the cycle will be represented the module path

Types

This section is empty.

Jump to

Keyboard shortcuts

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