tpl/fmt: Add erroridf template func

Fixes #8613
This commit is contained in:
Bjørn Erik Pedersen
2021-06-07 16:36:48 +02:00
parent 282f1aa3db
commit f55d2f4376
19 changed files with 170 additions and 71 deletions

11
deps/deps.go vendored
View File

@@ -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,