mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-08 19:36:36 +02:00
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
This commit is contained in:
committed by
GitHub
parent
ec1933f79d
commit
9dfa112617
@@ -1,13 +1,13 @@
|
||||
|
||||
# Test deprecation logging.
|
||||
hugo -e info --logLevel info
|
||||
stdout 'INFO deprecated: item was deprecated in Hugo'
|
||||
stderr 'INFO deprecated: item was deprecated in Hugo'
|
||||
|
||||
hugo -e warn --logLevel warn
|
||||
stdout 'WARN deprecated: item was deprecated in Hugo'
|
||||
stderr 'WARN deprecated: item was deprecated in Hugo'
|
||||
|
||||
! hugo -e error --logLevel warn
|
||||
stdout 'ERROR deprecated: item was deprecated in Hugo'
|
||||
stderr 'ERROR deprecated: item was deprecated in Hugo'
|
||||
|
||||
-- hugo.toml --
|
||||
baseURL = "https://example.com/"
|
||||
|
@@ -3,4 +3,5 @@ hugo
|
||||
! stderr .
|
||||
|
||||
-- config/_default/hugo.toml --
|
||||
baseURL = "https://example.com/"
|
||||
baseURL = "https://example.com/"
|
||||
disableKinds = ["RSS", "page", "sitemap", "robotsTXT", "404", "taxonomy", "term", "home"]
|
@@ -1,6 +1,6 @@
|
||||
hugo --printPathWarnings
|
||||
|
||||
stdout 'Duplicate'
|
||||
stderr 'Duplicate'
|
||||
|
||||
-- hugo.toml --
|
||||
-- assets/css/styles.css --
|
||||
|
@@ -1,6 +1,6 @@
|
||||
hugo --printPathWarnings
|
||||
|
||||
stdout 'Duplicate target paths: .index.html \(2\)'
|
||||
stderr 'Duplicate target paths: .index.html \(2\)'
|
||||
|
||||
-- hugo.toml --
|
||||
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "404", "section"]
|
||||
|
@@ -1,6 +1,6 @@
|
||||
hugo --printUnusedTemplates
|
||||
|
||||
stdout 'Template _default/list.html is unused'
|
||||
stderr 'Template _default/list.html is unused'
|
||||
|
||||
-- hugo.toml --
|
||||
disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "404", "section", "page"]
|
||||
|
13
testscripts/commands/warnf_stderr.txt
Normal file
13
testscripts/commands/warnf_stderr.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
# Issue #13074
|
||||
|
||||
hugo
|
||||
stderr 'warning'
|
||||
! stdout 'warning'
|
||||
|
||||
-- hugo.toml --
|
||||
baseURL = "http://example.org/"
|
||||
disableKinds = ["RSS", "page", "sitemap", "robotsTXT", "404", "taxonomy", "term"]
|
||||
-- layouts/index.html --
|
||||
Home
|
||||
{{ warnf "This is a warning" }}
|
||||
|
Reference in New Issue
Block a user