Skip to content

Commit

Permalink
fix: Adding tf-command-args support (#3679)
Browse files Browse the repository at this point in the history
* fix: Adding `tf-command-args` placeholder to logging configurations

* feat: Adding test for `tf-command-args` support
  • Loading branch information
yhakbar authored Dec 18, 2024
1 parent 0397ec4 commit e41d1c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions pkg/log/format/placeholders/placeholder.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ func newPlaceholders() Placeholders {
Message(),
Field(WorkDirKeyName, options.PathFormat(options.NonePath, options.RelativePath, options.ShortRelativePath, options.ShortPath)),
Field(TFPathKeyName, options.PathFormat(options.NonePath, options.FilenamePath, options.DirectoryPath)),
Field(TFCmdArgsKeyName),
}
}

Expand Down
6 changes: 3 additions & 3 deletions test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,11 @@ func TestLogCustomFormatOutput(t *testing.T) {
},
},
{
logCustomFormat: "%interval%(content=' plain-text ')%level(case=upper,width=6) %prefix(path=short-relative,suffix=' ')%tf-path(suffix=': ')%msg(path=relative)",
logCustomFormat: "%interval%(content=' plain-text ')%level(case=upper,width=6) %prefix(path=short-relative,suffix=' ')%tf-path(suffix=' ')%tf-command-args(suffix=': ')%msg(path=relative)",
expectedOutputRegs: []*regexp.Regexp{
regexp.MustCompile(`\d{4}` + regexp.QuoteMeta(" plain-text DEBUG Terragrunt Version:")),
regexp.MustCompile(`\d{4}` + regexp.QuoteMeta(" plain-text STDOUT dep "+wrappedBinary()+": Initializing the backend...")),
regexp.MustCompile(`\d{4}` + regexp.QuoteMeta(" plain-text STDOUT app "+wrappedBinary()+": Initializing the backend...")),
regexp.MustCompile(`\d{4}` + regexp.QuoteMeta(" plain-text STDOUT dep "+wrappedBinary()+" init -input=false -no-color: Initializing the backend...")),
regexp.MustCompile(`\d{4}` + regexp.QuoteMeta(" plain-text STDOUT app "+wrappedBinary()+" init -input=false -no-color: Initializing the backend...")),
},
},
}
Expand Down

0 comments on commit e41d1c2

Please sign in to comment.