Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test_hook.go « testhelper « internal - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 85fe4d244048bbd385cb2bf7a4fae567b0938e29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package testhelper

import (
	"io/ioutil"
	"testing"

	log "github.com/sirupsen/logrus"
)

// NewTestLogger creates logger that should be used in the tests.
var NewTestLogger = DiscardTestLogger

// DiscardTestLogger created a logrus hook that discards everything.
func DiscardTestLogger(tb testing.TB) *log.Logger {
	logger := log.New()
	logger.Out = ioutil.Discard

	return logger
}

// DiscardTestEntry creates a logrus entry that discards everything.
func DiscardTestEntry(tb testing.TB) *log.Entry {
	return log.NewEntry(DiscardTestLogger(tb))
}