mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-14 20:33:59 +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
@@ -365,7 +365,7 @@ func (c *Client) Get(args ...string) error {
|
||||
}
|
||||
|
||||
func (c *Client) get(args ...string) error {
|
||||
if err := c.runGo(context.Background(), c.logger.Out(), append([]string{"get"}, args...)...); err != nil {
|
||||
if err := c.runGo(context.Background(), c.logger.StdOut(), append([]string{"get"}, args...)...); err != nil {
|
||||
return fmt.Errorf("failed to get %q: %w", args, err)
|
||||
}
|
||||
return nil
|
||||
@@ -375,7 +375,7 @@ func (c *Client) get(args ...string) error {
|
||||
// If path is empty, Go will try to guess.
|
||||
// If this succeeds, this project will be marked as Go Module.
|
||||
func (c *Client) Init(path string) error {
|
||||
err := c.runGo(context.Background(), c.logger.Out(), "mod", "init", path)
|
||||
err := c.runGo(context.Background(), c.logger.StdOut(), "mod", "init", path)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to init modules: %w", err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user