mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Add a field prefix to the deprecated log statements
To make theme easier to spot, esp. on INFO level.
This commit is contained in:
parent
80f793c38d
commit
4d38f47250
2 changed files with 8 additions and 8 deletions
|
@ -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.
|
||||||
|
|
|
@ -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
|
hugo -e warn --logLevel warn
|
||||||
stdout 'INFO item was deprecated in Hugo'
|
stdout 'WARN deprecated: item was deprecated in Hugo'
|
||||||
|
|
||||||
hugo -e warn --logLevel warn
|
! hugo -e error --logLevel warn
|
||||||
stdout 'WARN item was deprecated in Hugo'
|
stdout 'ERROR deprecated: item was deprecated in Hugo'
|
||||||
|
|
||||||
! hugo -e error --logLevel warn
|
|
||||||
stdout 'ERROR item was deprecated in Hugo'
|
|
||||||
|
|
||||||
-- hugo.toml --
|
-- hugo.toml --
|
||||||
baseURL = "https://example.com/"
|
baseURL = "https://example.com/"
|
||||||
|
|
Loading…
Reference in a new issue