Skip to content

Commit b277cb3

Browse files
moorereasonbep
authored andcommitted
hugolib: Move metrics output to the end of the site build
1 parent a354d13 commit b277cb3

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

‎hugolib/hugo_sites_build.go‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package hugolib
1515

1616
import (
17+
"bytes"
1718
"time"
1819

1920
"errors"
@@ -66,6 +67,15 @@ func (h *HugoSites) Build(config BuildCfg, events ...fsnotify.Event) error {
6667
h.Log.FEEDBACK.Printf("total in %v ms\n", int(1000*time.Since(t0).Seconds()))
6768
}
6869

70+
if h.Metrics != nil {
71+
var b bytes.Buffer
72+
h.Metrics.WriteMetrics(&b)
73+
74+
h.Log.FEEDBACK.Printf("\nTemplate Metrics:\n\n")
75+
h.Log.FEEDBACK.Print(b.String())
76+
h.Log.FEEDBACK.Println()
77+
}
78+
6979
return nil
7080

7181
}

‎hugolib/site.go‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
package hugolib
1515

1616
import (
17-
"bytes"
1817
"errors"
1918
"fmt"
2019
"html/template"
@@ -1731,18 +1730,7 @@ func (s *Site) appendThemeTemplates(in []string) []string {
17311730
// Stats prints Hugo builds stats to the console.
17321731
// This is what you see after a successful hugo build.
17331732
func (s *Site) Stats() {
1734-
s.Log.FEEDBACK.Println()
1735-
1736-
if s.Cfg.GetBool("templateMetrics") {
1737-
var b bytes.Buffer
1738-
s.Metrics.WriteMetrics(&b)
1739-
1740-
s.Log.FEEDBACK.Printf("Template Metrics:\n\n")
1741-
s.Log.FEEDBACK.Print(b.String())
1742-
s.Log.FEEDBACK.Println()
1743-
}
1744-
1745-
s.Log.FEEDBACK.Printf("Built site for language %s:\n", s.Language.Lang)
1733+
s.Log.FEEDBACK.Printf("\nBuilt site for language %s:\n", s.Language.Lang)
17461734
s.Log.FEEDBACK.Println(s.draftStats())
17471735
s.Log.FEEDBACK.Println(s.futureStats())
17481736
s.Log.FEEDBACK.Println(s.expiredStats())

0 commit comments

Comments
 (0)