mirror of https://github.com/slackhq/nebula.git
30 lines
362 B
Go
30 lines
362 B
Go
package test
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func NewLogger() *logrus.Logger {
|
|
l := logrus.New()
|
|
|
|
v := os.Getenv("TEST_LOGS")
|
|
if v == "" {
|
|
l.SetOutput(io.Discard)
|
|
return l
|
|
}
|
|
|
|
switch v {
|
|
case "2":
|
|
l.SetLevel(logrus.DebugLevel)
|
|
case "3":
|
|
l.SetLevel(logrus.TraceLevel)
|
|
default:
|
|
l.SetLevel(logrus.InfoLevel)
|
|
}
|
|
|
|
return l
|
|
}
|