helper/logging: Warn about levels other than TRACE

The filtering for other log levels is unreliable and glitchy because it's
trying to infer information from the log stream that isn't reliably
represented.

Although the previous commit has improved the situation somewhat, it is
still a tricky and unreliable heuristic, so worth a warning to anyone who
is reading such a log that if they see something confusing it could be
a result of the heuristic not working fully.
This commit is contained in:
Martin Atkins 2019-12-05 11:49:11 -08:00
parent 30bf83cdeb
commit faffb3a784
1 changed files with 3 additions and 0 deletions

View File

@ -78,6 +78,9 @@ func CurrentLogLevel() string {
log.Printf("[WARN] Invalid log level: %q. Defaulting to level: TRACE. Valid levels are: %+v",
envLevel, ValidLevels)
}
if logLevel != "TRACE" {
log.Printf("[WARN] Log levels other than TRACE are currently unreliable, and are supported only for backward compatibility.\n Use TF_LOG=TRACE to see Terraform's internal logs.\n ----")
}
return logLevel
}