diff options
author | Bjørn Erik Pedersen <[email protected]> | 2023-11-01 15:21:21 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2023-11-01 16:40:26 +0100 |
commit | 4d38f47250f122dc370c9b3d6f58226cd2a18f62 (patch) | |
tree | bd2e33dc1d9f805f55cdf31737aee82d11427298 | |
parent | 80f793c38d250ca87b6083eb48d7420baaffd02c (diff) | |
download | hugo-4d38f47250f122dc370c9b3d6f58226cd2a18f62.tar.gz hugo-4d38f47250f122dc370c9b3d6f58226cd2a18f62.zip |
Add a field prefix to the deprecated log statements
To make theme easier to spot, esp. on INFO level.
-rw-r--r-- | common/hugo/hugo.go | 2 | ||||
-rw-r--r-- | testscripts/commands/deprecate.txt | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/common/hugo/hugo.go b/common/hugo/hugo.go index f6eb72d8f..dedbc8c98 100644 --- a/common/hugo/hugo.go +++ b/common/hugo/hugo.go @@ -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) } - 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. diff --git a/testscripts/commands/deprecate.txt b/testscripts/commands/deprecate.txt index b15d7ec84..3be4976d5 100644 --- a/testscripts/commands/deprecate.txt +++ b/testscripts/commands/deprecate.txt @@ -1,13 +1,13 @@ +# Test deprecation logging. +hugo -e info --logLevel info +stdout 'INFO deprecated: item was deprecated in Hugo' -hugo -e info --logLevel info -stdout 'INFO item was deprecated in Hugo' +hugo -e warn --logLevel warn +stdout 'WARN deprecated: item was deprecated in Hugo' -hugo -e warn --logLevel warn -stdout 'WARN item was deprecated in Hugo' - -! hugo -e error --logLevel warn -stdout 'ERROR item was deprecated in Hugo' +! hugo -e error --logLevel warn +stdout 'ERROR deprecated: item was deprecated in Hugo' -- hugo.toml -- baseURL = "https://example.com/" |