context

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2016 License: Unlicense Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInstanceID

func GetInstanceID(ctx Context) string

func GetStringValue

func GetStringValue(ctx Context, key interface{}) string

func GetVersion

func GetVersion(ctx Context) string

func Since

func Since(ctx Context, key interface{}) time.Duration

func WithValues

func WithValues(ctx context.Context, vals map[string]interface{}) context.Context

Types

type Context

type Context interface {
	context.Context
}

func Background

func Background() Context

func WithLogger

func WithLogger(ctx Context, logger Logger) Context

func WithValue

func WithValue(parent Context, key interface{}, val interface{}) Context

func WithVersion

func WithVersion(ctx Context, version string) Context

type Logger

type Logger interface {
	Print(args ...interface{})
	Printf(format string, args ...interface{})
	Println(args ...interface{})

	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
	Fatalln(args ...interface{})

	Panic(args ...interface{})
	Panicf(format string, args ...interface{})
	Panicln(args ...interface{})

	Debug(args ...interface{})
	Debugf(format string, args ...interface{})
	Debugln(args ...interface{})

	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	Errorln(args ...interface{})

	Info(args ...interface{})
	Infof(format string, args ...interface{})
	Infoln(args ...interface{})

	Warn(args ...interface{})
	Warnf(format string, args ...interface{})
	Warnln(args ...interface{})
}

func GetLogger

func GetLogger(ctx Context, keys ...interface{}) Logger

func GetLoggerWithField

func GetLoggerWithField(ctx Context, key, value interface{}, keys ...interface{}) Logger

func GetLoggerWithFields

func GetLoggerWithFields(ctx Context, fields map[interface{}]interface{}, keys ...interface{}) Logger

Jump to

Keyboard shortcuts

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