mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-11 20:03:58 +02:00
Revise the deprecation logging
This introduces a more automatic way of increasing the log levels for deprecation log statements based on the version it was deprecated. The thresholds are a little arbitrary, but * We log INFO for 6 releases * We log WARN for another 6 releases * THen ERROR (failing the build) This should give theme authors plenty of time to catch up without having the log filled with warnings.
This commit is contained in:
@@ -27,9 +27,6 @@ import (
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/gohugoio/hugo/common/hugo"
|
||||
"github.com/gohugoio/hugo/common/loggers"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
|
||||
"github.com/jdkato/prose/transform"
|
||||
@@ -246,19 +243,6 @@ func compareStringSlices(a, b []string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// Deprecated informs about a deprecation, but only once for a given set of arguments' values.
|
||||
// If the err flag is enabled, it logs as an ERROR (will exit with -1) and the text will
|
||||
// point at the next Hugo release.
|
||||
// The idea is two remove an item in two Hugo releases to give users and theme authors
|
||||
// plenty of time to fix their templates.
|
||||
func Deprecated(item, alternative string, err bool) {
|
||||
if err {
|
||||
loggers.Log().Errorf("%s is deprecated and will be removed in Hugo %s. %s", item, hugo.CurrentVersion.Next().ReleaseVersion(), alternative)
|
||||
} else {
|
||||
loggers.Log().Warnf("%s is deprecated and will be removed in a future release. %s", item, alternative)
|
||||
}
|
||||
}
|
||||
|
||||
// SliceToLower goes through the source slice and lowers all values.
|
||||
func SliceToLower(s []string) []string {
|
||||
if s == nil {
|
||||
|
Reference in New Issue
Block a user