diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-12-13 09:23:09 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2024-12-13 09:23:09 +0100 |
commit | 9dfa1126177952433f8339a87fb566c2959fc3d6 (patch) | |
tree | ad9c043d078688e5506f51d44df2474215c8b2b9 /testscripts | |
parent | ec1933f79d0da792d5c853cf7bf99fc9f0961162 (diff) | |
download | hugo-9dfa1126177952433f8339a87fb566c2959fc3d6.tar.gz hugo-9dfa1126177952433f8339a87fb566c2959fc3d6.zip |
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
Diffstat (limited to 'testscripts')
-rw-r--r-- | testscripts/commands/deprecate.txt | 6 | ||||
-rw-r--r-- | testscripts/commands/hugo__configdir.txt | 3 | ||||
-rw-r--r-- | testscripts/commands/hugo__path-warnings.txt | 2 | ||||
-rw-r--r-- | testscripts/commands/hugo_printpathwarnings.txt | 2 | ||||
-rw-r--r-- | testscripts/commands/hugo_printunusedtemplates.txt | 2 | ||||
-rw-r--r-- | testscripts/commands/warnf_stderr.txt | 13 |
6 files changed, 21 insertions, 7 deletions
diff --git a/testscripts/commands/deprecate.txt b/testscripts/commands/deprecate.txt index 3be4976d5..8791c3a78 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' +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/" diff --git a/testscripts/commands/hugo__configdir.txt b/testscripts/commands/hugo__configdir.txt index 4da62ade5..148523e9f 100644 --- a/testscripts/commands/hugo__configdir.txt +++ b/testscripts/commands/hugo__configdir.txt @@ -3,4 +3,5 @@ hugo ! stderr . -- config/_default/hugo.toml -- -baseURL = "https://example.com/"
\ No newline at end of file +baseURL = "https://example.com/" +disableKinds = ["RSS", "page", "sitemap", "robotsTXT", "404", "taxonomy", "term", "home"]
\ No newline at end of file diff --git a/testscripts/commands/hugo__path-warnings.txt b/testscripts/commands/hugo__path-warnings.txt index f7e3acd95..8eccb6567 100644 --- a/testscripts/commands/hugo__path-warnings.txt +++ b/testscripts/commands/hugo__path-warnings.txt @@ -1,6 +1,6 @@ hugo --printPathWarnings -stdout 'Duplicate' +stderr 'Duplicate' -- hugo.toml -- -- assets/css/styles.css -- diff --git a/testscripts/commands/hugo_printpathwarnings.txt b/testscripts/commands/hugo_printpathwarnings.txt index f4c76ebab..51eb46d91 100644 --- a/testscripts/commands/hugo_printpathwarnings.txt +++ b/testscripts/commands/hugo_printpathwarnings.txt @@ -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"] diff --git a/testscripts/commands/hugo_printunusedtemplates.txt b/testscripts/commands/hugo_printunusedtemplates.txt index 312e4920d..eb9e068d7 100644 --- a/testscripts/commands/hugo_printunusedtemplates.txt +++ b/testscripts/commands/hugo_printunusedtemplates.txt @@ -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"] diff --git a/testscripts/commands/warnf_stderr.txt b/testscripts/commands/warnf_stderr.txt new file mode 100644 index 000000000..f899253c5 --- /dev/null +++ b/testscripts/commands/warnf_stderr.txt @@ -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" }} + |