test

package
v12.4.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHook

func NewHook() (*test.Hook, func())

NewHook will create a new global hook that can be used for tests after which it will remove when the returned function invoked.

This shouldn't be used when you are writing a new package/structure, you should instead pass the logger to that struct and add the Hook to that struct only, try to avoid the global logger. This has multiple benefits, for example having that struct with specific logger settings that doesn't effect the logger in another part of the application. For example:

type MyNewStruct struct {
		logger   logrus.FieldLogger
}

The more hooks we add to the tests the more memory we are leaking.

Types

This section is empty.

Jump to

Keyboard shortcuts

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