diff options
author | Stan Hu <stanhu@gmail.com> | 2020-03-07 00:46:26 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2020-03-10 00:41:24 -0700 |
commit | 488102039cb5e79114954ad91663ce28c99153c8 (patch) | |
tree | 808256b23022449477aa8e17ad3865ba6a3213b6 /internal/testhelper/testhelper.go | |
parent | b920520599142435ce06ad155099544adc923618 (diff) | |
download | gitlab-shell-sh-log-http-requests.tar.gz |
Log internal HTTP requestssh-log-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.go | 9 |
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 +} |