diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-06-05 10:05:20 +0300 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-06-05 10:45:24 +0300 |
commit | bf5f10faa9fd445c4dd21839aa7d73cd2acbfb85 (patch) | |
tree | c00b47586809b7fb9d8ba13f22eb8a3194245b5f | |
parent | 019bd5576be87c9f06b6a928ede1a5e78677f7b3 (diff) |
Reset the "distinct error logger" on rebuilds
Fixes #4818
-rw-r--r-- | commands/hugo.go | 1 | ||||
-rw-r--r-- | hugolib/hugo_sites.go | 8 | ||||
-rw-r--r-- | hugolib/hugo_sites_build.go | 1 |
3 files changed, 9 insertions, 1 deletions
diff --git a/commands/hugo.go b/commands/hugo.go index b898a9b7b..8f7860f76 100644 --- a/commands/hugo.go +++ b/commands/hugo.go @@ -670,7 +670,6 @@ func (c *commandeer) resetAndBuildSites() (err error) { func (c *commandeer) initSites() error { if c.hugo != nil { c.hugo.Cfg = c.Cfg - c.hugo.Log.ResetLogCounters() return nil } diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go index c5c08b191..ad233f1c2 100644 --- a/hugolib/hugo_sites.go +++ b/hugolib/hugo_sites.go @@ -280,6 +280,14 @@ func (h *HugoSites) reset() { } } +// resetLogs resets the log counters etc. Used to do a new build on the same sites. +func (h *HugoSites) resetLogs() { + h.Log.ResetLogCounters() + for _, s := range h.Sites { + s.Deps.DistinctErrorLog = helpers.NewDistinctLogger(h.Log.ERROR) + } +} + func (h *HugoSites) createSitesFromConfig() error { oldLangs, _ := h.Cfg.Get("languagesSorted").(helpers.Languages) diff --git a/hugolib/hugo_sites_build.go b/hugolib/hugo_sites_build.go index e22aabfc5..7769b68dc 100644 --- a/hugolib/hugo_sites_build.go +++ b/hugolib/hugo_sites_build.go @@ -131,6 +131,7 @@ func (h *HugoSites) initRebuild(config *BuildCfg) error { s.resetBuildState() } + h.resetLogs() helpers.InitLoggers() return nil |