summaryrefslogtreecommitdiff
path: root/internal/testhelper/testhelper.go
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2020-03-07 00:46:26 -0800
committerStan Hu <stanhu@gmail.com>2020-03-10 21:58:15 -0700
commit70c1b494b81f0035b71e47a65a70a8b86a2c8427 (patch)
tree5b327b7f90ea94b39d541c24f09bf316424c5760 /internal/testhelper/testhelper.go
parentb920520599142435ce06ad155099544adc923618 (diff)
downloadgitlab-shell-70c1b494b81f0035b71e47a65a70a8b86a2c8427.tar.gz
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
Diffstat (limited to 'internal/testhelper/testhelper.go')
-rw-r--r--internal/testhelper/testhelper.go9
1 files changed, 9 insertions, 0 deletions
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
+}