Add a field prefix to the deprecated log statements

To make theme easier to spot, esp. on INFO level.
This commit is contained in:
Bjørn Erik Pedersen 2023-11-01 15:21:21 +01:00
parent 80f793c38d
commit 4d38f47250
2 changed files with 8 additions and 8 deletions

View file

@ -369,7 +369,7 @@ func DeprecateLevel(item, alternative, version string, level logg.Level) {
msg = fmt.Sprintf("%s was deprecated in Hugo %s and will be removed in a future release. %s", item, version, alternative) msg = fmt.Sprintf("%s was deprecated in Hugo %s and will be removed in a future release. %s", item, version, alternative)
} }
loggers.Log().Logger().WithLevel(level).Logf(msg) loggers.Log().Logger().WithLevel(level).WithField(loggers.FieldNameCmd, "deprecated").Logf(msg)
} }
// We ususally do about one minor version a month. // We ususally do about one minor version a month.

View file

@ -1,13 +1,13 @@
# Test deprecation logging.
hugo -e info --logLevel info hugo -e info --logLevel info
stdout 'INFO item was deprecated in Hugo' stdout 'INFO deprecated: item was deprecated in Hugo'
hugo -e warn --logLevel warn hugo -e warn --logLevel warn
stdout 'WARN item was deprecated in Hugo' stdout 'WARN deprecated: item was deprecated in Hugo'
! hugo -e error --logLevel warn ! hugo -e error --logLevel warn
stdout 'ERROR item was deprecated in Hugo' stdout 'ERROR deprecated: item was deprecated in Hugo'
-- hugo.toml -- -- hugo.toml --
baseURL = "https://example.com/" baseURL = "https://example.com/"