diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-10-26 09:38:13 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-10-26 20:41:19 +0200 |
commit | 71fd79a3f44101ef515349a24527e6c0b566f368 (patch) | |
tree | 4bd1763b0b09a5767ee5501b6df298fd12efc6d2 /helpers/general.go | |
parent | c4a530f104f2b0d1dd82211b77b603a07db7c181 (diff) |
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.
Diffstat (limited to 'helpers/general.go')
-rw-r--r-- | helpers/general.go | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/helpers/general.go b/helpers/general.go index e484b92f0..281414b2a 100644 --- a/helpers/general.go +++ b/helpers/general.go @@ -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 { |