Skip to content

Commit

Permalink
Log which templates are rendered
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsauter committed Oct 24, 2023
1 parent 2199e0a commit 50f5765
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ type keyedFileDataMap map[string]fileDataMap
var nonAlphanumericRegex = regexp.MustCompile(`[^a-zA-Z0-9]+`)

func render(baseDir, templateGlob, outputDir string, dataSourceGlobs []string) error {
if !strings.HasSuffix(baseDir, "/") {
baseDir = baseDir + "/"
}
if !filepath.IsAbs(outputDir) {
outputDir = filepath.Join(baseDir, outputDir)
}
Expand All @@ -37,6 +40,11 @@ func render(baseDir, templateGlob, outputDir string, dataSourceGlobs []string) e
return err
}
for _, templateFile := range matches {
log.Printf(
"Rendering template %q into %q ...",
strings.TrimPrefix(templateFile, baseDir),
strings.TrimPrefix(outputDir, baseDir),
)
tmpl, err := template.ParseFiles(templateFile)
if err != nil {
return fmt.Errorf("parse template %q: %s", templateFile, err)
Expand Down

0 comments on commit 50f5765

Please sign in to comment.