diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-06-07 16:36:48 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-06-07 19:11:03 +0200 |
commit | f55d2f43769053b80b419a690554e747dc5dcede (patch) | |
tree | f8c5bdc95df123f2abb04d66b87af4bf9237f086 /hugolib | |
parent | 282f1aa3db9f6420fdd360e46db1ffadd5b083a1 (diff) |
tpl/fmt: Add erroridf template func
Fixes #8613
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/alias.go | 2 | ||||
-rw-r--r-- | hugolib/collections.go | 1 | ||||
-rw-r--r-- | hugolib/hugo_sites.go | 3 | ||||
-rw-r--r-- | hugolib/page__new.go | 2 | ||||
-rw-r--r-- | hugolib/site.go | 10 | ||||
-rw-r--r-- | hugolib/site_render.go | 4 |
6 files changed, 11 insertions, 11 deletions
diff --git a/hugolib/alias.go b/hugolib/alias.go index 891098c9d..2609cd6bb 100644 --- a/hugolib/alias.go +++ b/hugolib/alias.go @@ -79,7 +79,7 @@ func (s *Site) writeDestAlias(path, permalink string, outputFormat output.Format func (s *Site) publishDestAlias(allowRoot bool, path, permalink string, outputFormat output.Format, p page.Page) (err error) { handler := newAliasHandler(s.Tmpl(), s.Log, allowRoot) - s.Log.Debug().Println("creating alias:", path, "redirecting to", permalink) + s.Log.Debugln("creating alias:", path, "redirecting to", permalink) targetPath, err := handler.targetPathAlias(path) if err != nil { diff --git a/hugolib/collections.go b/hugolib/collections.go index a794a9866..9b4f83cc6 100644 --- a/hugolib/collections.go +++ b/hugolib/collections.go @@ -28,7 +28,6 @@ var ( // implementations have no value on their own. // Slice is not meant to be used externally. It's a bridge function -// for the template functions. See collections.Slice. func (p *pageState) Slice(items interface{}) (interface{}, error) { return page.ToPages(items) } diff --git a/hugolib/hugo_sites.go b/hugolib/hugo_sites.go index a016cab99..0607bde1c 100644 --- a/hugolib/hugo_sites.go +++ b/hugolib/hugo_sites.go @@ -579,7 +579,8 @@ func (h *HugoSites) resetLogs() { h.Log.Reset() loggers.GlobalErrorCounter.Reset() for _, s := range h.Sites { - s.Deps.DistinctErrorLog = helpers.NewDistinctLogger(h.Log.Error()) + s.Deps.Log.Reset() + s.Deps.LogDistinct.Reset() } } diff --git a/hugolib/page__new.go b/hugolib/page__new.go index b37631477..8c96d5014 100644 --- a/hugolib/page__new.go +++ b/hugolib/page__new.go @@ -102,7 +102,7 @@ func newPageFromMeta( meta map[string]interface{}, metaProvider *pageMeta) (*pageState, error) { if metaProvider.f == nil { - metaProvider.f = page.NewZeroFile(metaProvider.s.DistinctWarningLog) + metaProvider.f = page.NewZeroFile(metaProvider.s.LogDistinct) } ps, err := newPageBase(metaProvider) diff --git a/hugolib/site.go b/hugolib/site.go index 3c7c03bd1..12714892d 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -1007,7 +1007,7 @@ func (s *Site) processPartial(config *BuildCfg, init func(config *BuildCfg) erro changeIdentities := make(identity.Identities) - s.Log.Debug().Printf("Rebuild for events %q", events) + s.Log.Debugf("Rebuild for events %q", events) h := s.h @@ -1026,7 +1026,7 @@ func (s *Site) processPartial(config *BuildCfg, init func(config *BuildCfg) erro sourceFilesChanged = make(map[string]bool) // prevent spamming the log on changes - logger = helpers.NewDistinctFeedbackLogger() + logger = helpers.NewDistinctErrorLogger() ) var cachePartitions []string @@ -1385,7 +1385,7 @@ func (s *Site) getMenusFromConfig() navigation.Menus { s.Log.Errorln(err) } else { for _, entry := range m { - s.Log.Debug().Printf("found menu: %q, in site config\n", name) + s.Log.Debugf("found menu: %q, in site config\n", name) menuEntry := navigation.MenuEntry{Menu: name} ime, err := maps.ToStringMapE(entry) @@ -1646,7 +1646,7 @@ func (s *Site) lookupLayouts(layouts ...string) tpl.Template { } func (s *Site) renderAndWriteXML(statCounter *uint64, name string, targetPath string, d interface{}, templ tpl.Template) error { - s.Log.Debug().Printf("Render XML for %q to %q", name, targetPath) + s.Log.Debugf("Render XML for %q to %q", name, targetPath) renderBuffer := bp.GetBuffer() defer bp.PutBuffer(renderBuffer) @@ -1668,7 +1668,7 @@ func (s *Site) renderAndWriteXML(statCounter *uint64, name string, targetPath st } func (s *Site) renderAndWritePage(statCounter *uint64, name string, targetPath string, p *pageState, templ tpl.Template) error { - s.Log.Debug().Printf("Render %s to %q", name, targetPath) + s.Log.Debugf("Render %s to %q", name, targetPath) renderBuffer := bp.GetBuffer() defer bp.PutBuffer(renderBuffer) diff --git a/hugolib/site_render.go b/hugolib/site_render.go index 84293cfc0..77ece780b 100644 --- a/hugolib/site_render.go +++ b/hugolib/site_render.go @@ -389,13 +389,13 @@ func (s *Site) renderMainLanguageRedirect() error { mainLang := s.h.multilingual.DefaultLang if s.Info.defaultContentLanguageInSubdir { mainLangURL := s.PathSpec.AbsURL(mainLang.Lang+"/", false) - s.Log.Debug().Printf("Write redirect to main language %s: %s", mainLang, mainLangURL) + s.Log.Debugf("Write redirect to main language %s: %s", mainLang, mainLangURL) if err := s.publishDestAlias(true, "/", mainLangURL, html, nil); err != nil { return err } } else { mainLangURL := s.PathSpec.AbsURL("", false) - s.Log.Debug().Printf("Write redirect to main language %s: %s", mainLang, mainLangURL) + s.Log.Debugf("Write redirect to main language %s: %s", mainLang, mainLangURL) if err := s.publishDestAlias(true, mainLang.Lang, mainLangURL, html, nil); err != nil { return err } |