commontest

package
v0.0.0-...-4e290a4 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestCtx

type TestCtx struct {
	// contains filtered or unexported fields
}

TestCtx returns a test context which implements the api context interface

func NewTestContext

func NewTestContext() *TestCtx

NewTestContext creates a new instance of the test context

func (TestCtx) BaseLogger

func (c TestCtx) BaseLogger() *logrus.Logger

BaseLogger - returns the base logger without additional fields

func (TestCtx) GenericLogger

func (c TestCtx) GenericLogger(logLevel string, key string, value interface{}) *log.Logger

GenericLogger provides the generic logger which outputs to the logrus writer along with additional fields (used for passing to third party libraries)

func (TestCtx) Hook

func (c TestCtx) Hook() *test.Hook

Hook - returns logging hook for retrieving logging messages - handy for testing

func (TestCtx) Log

func (c TestCtx) Log() logrus.FieldLogger

Log provides read only access to logger

func (TestCtx) Render

func (c TestCtx) Render() *render.Render

Render provides read only access to render

func (TestCtx) Validate

func (c TestCtx) Validate() *validator.Validate

Validate provides read only access to validates

func (TestCtx) Wrap

func (c TestCtx) Wrap(fields map[string]interface{}) api.Context

Wrap additional fields for logging (used When passing context into a method)

Jump to

Keyboard shortcuts

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