hugo-wasm/testscripts/commands/deprecate.txt
Bjørn Erik Pedersen 9dfa112617
Write all logging (INFO, WARN, ERROR) to stderr
The old setup tried to log >= warning to stderr, the rest to stdout.

However, that logic was flawed, so warnings ended up in stdout, which makes `hugo list all` etc. hard to reason about from scripts.

This commit fixes this by making all logging (info, warn, error) log to stderr and let stdout be reserved for program output.

Fixes #13074
2024-12-13 09:23:09 +01:00

25 lines
No EOL
716 B
Text

# Test deprecation logging.
hugo -e info --logLevel info
stderr 'INFO deprecated: item was deprecated in Hugo'
hugo -e warn --logLevel warn
stderr 'WARN deprecated: item was deprecated in Hugo'
! hugo -e error --logLevel warn
stderr 'ERROR deprecated: item was deprecated in Hugo'
-- hugo.toml --
baseURL = "https://example.com/"
disableKinds = ["taxonomy", "term"]
-- layouts/index.html --
Deprecate:
{{ if eq hugo.Environment "info" }}
{{ debug.TestDeprecationInfo "item" "alternative" }}
{{ end }}
{{ if eq hugo.Environment "warn" }}
{{ debug.TestDeprecationWarn "item" "alternative" }}
{{ end }}
{{ if eq hugo.Environment "error" }}
{{ debug.TestDeprecationErr "item" "alternative" }}
{{ end }}