From 488102039cb5e79114954ad91663ce28c99153c8 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 7 Mar 2020 00:46:26 -0800 Subject: Log internal HTTP requests This restores the previous behavior of logging the success and failures of internal HTTP requests. Part of https://gitlab.com/gitlab-org/gitlab/issues/207916 --- internal/testhelper/testhelper.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'internal/testhelper/testhelper.go') diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go index a925c79..da781ce 100644 --- a/internal/testhelper/testhelper.go +++ b/internal/testhelper/testhelper.go @@ -8,6 +8,8 @@ import ( "runtime" "github.com/otiai10/copy" + "github.com/sirupsen/logrus" + "github.com/sirupsen/logrus/hooks/test" ) var ( @@ -91,3 +93,10 @@ func Setenv(key, value string) (func(), error) { err := os.Setenv(key, value) return func() { os.Setenv(key, oldValue) }, err } + +func SetupLogger() *test.Hook { + logger, hook := test.NewNullLogger() + logrus.SetOutput(logger.Writer()) + + return hook +} -- cgit v1.2.1