Merge pull request #16500 from hashicorp/b-helper-testing-fallback

helper: Fall back to TF_LOG_PATH instead of os.Stderr
This commit is contained in:
Radek Simko 2017-10-30 19:03:56 +00:00 committed by GitHub
commit 8ae74e66e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -372,6 +372,15 @@ func LogOutput(t TestT) (logOutput io.Writer, err error) {
}
logOutput = os.Stderr
if logPath := os.Getenv(logging.EnvLogFile); logPath != "" {
var err error
logOutput, err = os.OpenFile(logPath, syscall.O_CREAT|syscall.O_RDWR|syscall.O_APPEND, 0666)
if err != nil {
return nil, err
}
}
if logPathMask := os.Getenv(EnvLogPathMask); logPathMask != "" {
logPath := fmt.Sprintf(logPathMask, t.Name())
var err error