test: add NOMAD_TEST_LOG_LEVEL env var to tune log levels
This commit is contained in:
parent
b79021adfd
commit
3ac3ceb2cc
|
@ -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,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue