0
0
Fork 0
mirror of https://github.com/slackhq/nebula.git synced 2025-01-11 20:08:12 +00:00
slackhq_nebula/util/main.go
2021-11-03 20:54:04 -05:00

29 lines
377 B
Go

package util
import (
"io/ioutil"
"os"
"github.com/sirupsen/logrus"
)
func NewTestLogger() *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
}