common

package
v0.0.0-...-c4ccf5f Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTemporary

func IsTemporary(err error) bool

func Logger

func Logger(ctx context.Context) logrus.FieldLogger

Logger returns the structured logger.

func LoggerWithFields

func LoggerWithFields(ctx context.Context, fields logrus.Fields) (context.Context, logrus.FieldLogger)

Attempt at simplifying this whole logger in the context thing Could even make this take a generic map, then the logger that gets returned could be used just like the stdlib too, since it's compatible

func NewRNG

func NewRNG(seed int64) *rand.Rand

func NewSyslogHook

func NewSyslogHook(url *url.URL, prefix string) error

func SetLogDest

func SetLogDest(to, prefix string)

func SetLogLevel

func SetLogLevel(ll string)

func WithLogger

func WithLogger(ctx context.Context, l logrus.FieldLogger) context.Context

WithLogger stores the logger.

Types

type Backoff

type Backoff int

func (*Backoff) Sleep

func (b *Backoff) Sleep(ctx context.Context)

type BoxTime

type BoxTime struct{}

func (BoxTime) After

func (BoxTime) After(d time.Duration) <-chan time.Time

func (BoxTime) Now

func (BoxTime) Now() time.Time

func (BoxTime) Sleep

func (BoxTime) Sleep(d time.Duration)

type Clock

type Clock interface {
	Now() time.Time
	Sleep(time.Duration)
	After(time.Duration) <-chan time.Time
}

type Temporary

type Temporary interface {
	Temporary() bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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