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

@@ -130,7 +130,7 @@ func (p *pageMeta) Aliases() []string {
}
func (p *pageMeta) Author() page.Author {
helpers.Deprecated(".Author", "Use taxonomies.", false)
hugo.Deprecate(".Author", "Use taxonomies.", "v0.98.0")
authors := p.Authors()
for _, author := range authors {
@@ -140,7 +140,7 @@ func (p *pageMeta) Author() page.Author {
}
func (p *pageMeta) Authors() page.AuthorList {
helpers.Deprecated(".Authors", "Use taxonomies.", true)
hugo.Deprecate(".Author", "Use taxonomies.", "v0.112.0")
return nil
}
@@ -226,7 +226,7 @@ func (p *pageMeta) Path() string {
{{ $path = .Path }}
{{ end }}
`
helpers.Deprecated(".Path when the page is backed by a file", "We plan to use Path for a canonical source path and you probably want to check the source is a file. To get the current behaviour, you can use a construct similar to the one below:\n"+example, false)
p.s.Log.Warnln(".Path when the page is backed by a file is deprecated. We plan to use Path for a canonical source path and you probably want to check the source is a file. To get the current behaviour, you can use a construct similar to the one below:\n" + example)
}