mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-25 22:00:58 +02:00
Add warnidf template function
Also rename config `ignoreErrors` => `ignoreLogs` But the old still works. Closes #9189
This commit is contained in:
@@ -68,9 +68,7 @@ func (ns *Namespace) Errorf(format string, args ...any) string {
|
||||
// an information text that the error with the given id can be suppressed in config.
|
||||
// It returns an empty string.
|
||||
func (ns *Namespace) Erroridf(id, format string, args ...any) string {
|
||||
format += "\nYou can suppress this error by adding the following to your site configuration:\nignoreErrors = ['%s']"
|
||||
args = append(args, id)
|
||||
ns.logger.Errorsf(id, format, args...)
|
||||
ns.logger.Erroridf(id, format, args...)
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -81,6 +79,14 @@ func (ns *Namespace) Warnf(format string, args ...any) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// Warnidf formats args according to a format specifier and logs an WARNING and
|
||||
// an information text that the warning with the given id can be suppressed in config.
|
||||
// It returns an empty string.
|
||||
func (ns *Namespace) Warnidf(id, format string, args ...any) string {
|
||||
ns.logger.Warnidf(id, format, args...)
|
||||
return ""
|
||||
}
|
||||
|
||||
// Warnmf is epxermimental and subject to change at any time.
|
||||
func (ns *Namespace) Warnmf(m any, format string, args ...any) string {
|
||||
return ns.logmf(ns.logger.Warn(), m, format, args...)
|
||||
|
Reference in New Issue
Block a user