mirror of https://github.com/slackhq/nebula.git
30 lines
373 B
Go
30 lines
373 B
Go
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
|
|
}
|