Skip to content

Commit

Permalink
hugolib: Move metrics output to the end of the site build
Browse files Browse the repository at this point in the history
  • Loading branch information
moorereason authored and bep committed Sep 27, 2017
1 parent a354d13 commit b277cb3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
10 changes: 10 additions & 0 deletions hugolib/hugo_sites_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package hugolib

import (
"bytes"
"time"

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

if h.Metrics != nil {
var b bytes.Buffer
h.Metrics.WriteMetrics(&b)

h.Log.FEEDBACK.Printf("\nTemplate Metrics:\n\n")
h.Log.FEEDBACK.Print(b.String())
h.Log.FEEDBACK.Println()
}

return nil

}
Expand Down
14 changes: 1 addition & 13 deletions hugolib/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package hugolib

import (
"bytes"
"errors"
"fmt"
"html/template"
Expand Down Expand Up @@ -1731,18 +1730,7 @@ func (s *Site) appendThemeTemplates(in []string) []string {
// Stats prints Hugo builds stats to the console.
// This is what you see after a successful hugo build.
func (s *Site) Stats() {
s.Log.FEEDBACK.Println()

if s.Cfg.GetBool("templateMetrics") {
var b bytes.Buffer
s.Metrics.WriteMetrics(&b)

s.Log.FEEDBACK.Printf("Template Metrics:\n\n")
s.Log.FEEDBACK.Print(b.String())
s.Log.FEEDBACK.Println()
}

s.Log.FEEDBACK.Printf("Built site for language %s:\n", s.Language.Lang)
s.Log.FEEDBACK.Printf("\nBuilt site for language %s:\n", s.Language.Lang)
s.Log.FEEDBACK.Println(s.draftStats())
s.Log.FEEDBACK.Println(s.futureStats())
s.Log.FEEDBACK.Println(s.expiredStats())
Expand Down

0 comments on commit b277cb3

Please sign in to comment.