summaryrefslogtreecommitdiffstats
path: root/tpl
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-10-26 09:38:13 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-10-26 20:41:19 +0200
commit71fd79a3f44101ef515349a24527e6c0b566f368 (patch)
tree4bd1763b0b09a5767ee5501b6df298fd12efc6d2 /tpl
parentc4a530f104f2b0d1dd82211b77b603a07db7c181 (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 'tpl')
-rw-r--r--tpl/collections/collections.go4
-rw-r--r--tpl/lang/lang.go7
2 files changed, 5 insertions, 6 deletions
diff --git a/tpl/collections/collections.go b/tpl/collections/collections.go
index 2f7eb745b..279dbb169 100644
--- a/tpl/collections/collections.go
+++ b/tpl/collections/collections.go
@@ -28,10 +28,10 @@ import (
"errors"
"github.com/gohugoio/hugo/common/collections"
+ "github.com/gohugoio/hugo/common/hugo"
"github.com/gohugoio/hugo/common/maps"
"github.com/gohugoio/hugo/common/types"
"github.com/gohugoio/hugo/deps"
- "github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/langs"
"github.com/gohugoio/hugo/tpl/compare"
"github.com/spf13/cast"
@@ -200,7 +200,7 @@ func (ns *Namespace) Dictionary(values ...any) (map[string]any, error) {
// empty string.
// Deprecated: Use the index function instead.
func (ns *Namespace) EchoParam(c, k any) any {
- helpers.Deprecated("collections.EchoParam", "Use the index function instead.", false)
+ hugo.Deprecate("collections.EchoParam", "Use the index function instead.", "v0.120.0")
av, isNil := indirect(reflect.ValueOf(c))
if isNil {
return ""
diff --git a/tpl/lang/lang.go b/tpl/lang/lang.go
index e83f70710..92b3aa8ff 100644
--- a/tpl/lang/lang.go
+++ b/tpl/lang/lang.go
@@ -16,19 +16,18 @@ package lang
import (
"context"
+ "errors"
"fmt"
"math"
"strconv"
"strings"
- "errors"
-
"github.com/gohugoio/locales"
translators "github.com/gohugoio/localescompressed"
"github.com/gohugoio/hugo/common/hreflect"
+ "github.com/gohugoio/hugo/common/hugo"
"github.com/gohugoio/hugo/deps"
- "github.com/gohugoio/hugo/helpers"
"github.com/spf13/cast"
)
@@ -243,7 +242,7 @@ func (ns *Namespace) FormatNumberCustom(precision, number any, options ...any) (
// Deprecated: Use lang.FormatNumberCustom instead.
func (ns *Namespace) NumFmt(precision, number any, options ...any) (string, error) {
- helpers.Deprecated("lang.NumFmt", "Use lang.FormatNumberCustom instead.", false)
+ hugo.Deprecate("lang.NumFmt", "Use lang.FormatNumberCustom instead.", "v0.120.0")
return ns.FormatNumberCustom(precision, number, options...)
}