test

package
v12.5.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2019 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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