test: add NOMAD_TEST_LOG_LEVEL env var to tune log levels

This commit is contained in:
Tim Gross 2019-08-29 14:59:12 -04:00
parent b79021adfd
commit 3ac3ceb2cc

View file

@ -73,8 +73,13 @@ func Logger(t LogPrinter) *log.Logger {
//HCLogger returns a new test hc-logger. //HCLogger returns a new test hc-logger.
func HCLogger(t LogPrinter) hclog.Logger { func HCLogger(t LogPrinter) hclog.Logger {
level := hclog.Trace
envLogLevel := os.Getenv("NOMAD_TEST_LOG_LEVEL")
if envLogLevel != "" {
level = hclog.LevelFromString(envLogLevel)
}
opts := &hclog.LoggerOptions{ opts := &hclog.LoggerOptions{
Level: hclog.Trace, Level: level,
Output: NewWriter(t), Output: NewWriter(t),
IncludeLocation: true, IncludeLocation: true,
} }