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
1 changed files with 6 additions and 1 deletions

View File

@ -73,8 +73,13 @@ func Logger(t LogPrinter) *log.Logger {
//HCLogger returns a new test hc-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{
Level: hclog.Trace,
Level: level,
Output: NewWriter(t),
IncludeLocation: true,
}