diff options
author | Bjørn Erik Pedersen <[email protected]> | 2021-06-07 16:36:48 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2021-06-07 19:11:03 +0200 |
commit | f55d2f43769053b80b419a690554e747dc5dcede (patch) | |
tree | f8c5bdc95df123f2abb04d66b87af4bf9237f086 /deps/deps.go | |
parent | 282f1aa3db9f6420fdd360e46db1ffadd5b083a1 (diff) | |
download | hugo-f55d2f43769053b80b419a690554e747dc5dcede.tar.gz hugo-f55d2f43769053b80b419a690554e747dc5dcede.zip |
tpl/fmt: Add erroridf template func
Fixes #8613
Diffstat (limited to 'deps/deps.go')
-rw-r--r-- | deps/deps.go | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/deps/deps.go b/deps/deps.go index 36620c96b..c0546db76 100644 --- a/deps/deps.go +++ b/deps/deps.go @@ -34,10 +34,7 @@ type Deps struct { Log loggers.Logger `json:"-"` // Used to log errors that may repeat itself many times. - DistinctErrorLog *helpers.DistinctLogger - - // Used to log warnings that may repeat itself many times. - DistinctWarningLog *helpers.DistinctLogger + LogDistinct loggers.Logger // The templates to use. This will usually implement the full tpl.TemplateManager. tmpl tpl.TemplateHandler @@ -266,14 +263,12 @@ func New(cfg DepsCfg) (*Deps, error) { ignoreErrors := cast.ToStringSlice(cfg.Cfg.Get("ignoreErrors")) ignorableLogger := loggers.NewIgnorableLogger(logger, ignoreErrors...) - distinctErrorLogger := helpers.NewDistinctLogger(logger.Error()) - distinctWarnLogger := helpers.NewDistinctLogger(logger.Warn()) + logDistinct := helpers.NewDistinctLogger(logger) d := &Deps{ Fs: fs, Log: ignorableLogger, - DistinctErrorLog: distinctErrorLogger, - DistinctWarningLog: distinctWarnLogger, + LogDistinct: logDistinct, templateProvider: cfg.TemplateProvider, translationProvider: cfg.TranslationProvider, WithTemplate: cfg.WithTemplate, |