Move util to test, contextual errors to util (#575)

This commit is contained in:
Nate Brown 2021-11-10 21:47:38 -06:00 committed by GitHub
parent 19a9a4221e
commit 4453964e34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 117 additions and 106 deletions

29
test/logger.go Normal file
View file

@ -0,0 +1,29 @@
package test
import (
"io/ioutil"
"os"
"github.com/sirupsen/logrus"
)
func NewLogger() *logrus.Logger {
l := logrus.New()
v := os.Getenv("TEST_LOGS")
if v == "" {
l.SetOutput(ioutil.Discard)
return l
}
switch v {
case "2":
l.SetLevel(logrus.DebugLevel)
case "3":
l.SetLevel(logrus.TraceLevel)
default:
l.SetLevel(logrus.InfoLevel)
}
return l
}