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:
Bjørn Erik Pedersen
2023-10-26 09:38:13 +02:00
parent c4a530f104
commit 71fd79a3f4
12 changed files with 93 additions and 68 deletions

View File

@@ -21,6 +21,7 @@ import (
"time"
"github.com/bep/gitmap"
"github.com/gohugoio/hugo/common/hugo"
"github.com/gohugoio/hugo/common/paths"
"github.com/gohugoio/hugo/hugofs/files"
@@ -63,7 +64,6 @@ type fileOverlap interface {
}
type FileWithoutOverlap interface {
// Filename gets the full path and filename to the file.
Filename() string
@@ -102,7 +102,6 @@ type FileWithoutOverlap interface {
// FileInfo describes a source file.
type FileInfo struct {
// Absolute filename to the file on disk.
filename string
@@ -143,7 +142,7 @@ func (fi *FileInfo) Dir() string { return fi.relDir }
// Extension is an alias to Ext().
func (fi *FileInfo) Extension() string {
helpers.Deprecated(".File.Extension", "Use .File.Ext instead. ", false)
hugo.Deprecate(".File.Extension", "Use .File.Ext instead.", "v0.96.0")
return fi.Ext()
}