Repository: gohugoio/hugo (language: go)

Issue:
common/loggers: Write PrintTimerIfDelayed output to stdErr
In https://github.com/gohugoio/hugo/pull/13138 we made all logging (info, warn, error) log to `stderr` and let `stdout` be reserved for program output.

When you run `hugo` against a project that includes a module that has not been downloaded yet, this is written to `stdout`:

    hugo: collected modules in 962 ms

If you run the command `hugo list all` before the module has been downloaded, the resulting CSV data is invalid.

If seems like the message above should be logged to `stdErr` instead.

https://github.com/gohugoio/hugo/blob/5d64b492f41ca9f805948f33b47672780f9cea7d/modules/collect.go#L509

https://github.com/gohugoio/hugo/blob/5d64b492f41ca9f805948f33b47672780f9cea7d/common/loggers/logger.go#L270-L279

Can we replace the last line in the above with this?

```go
fmt.Fprintf(l.stdErr, "%s in %v ms", name, milli)
```


Discussion / hints:

Fix patch:
diff --git a/common/loggers/logger.go b/common/loggers/logger.go
index 77a21458a4a..a013049f770 100644
--- a/common/loggers/logger.go
+++ b/common/loggers/logger.go
@@ -275,7 +275,7 @@ func (l *logAdapter) PrintTimerIfDelayed(start time.Time, name string) {
 	if milli < 500 {
 		return
 	}
-	l.Printf("%s in %v ms", name, milli)
+	fmt.Fprintf(l.stdErr, "%s in %v ms", name, milli)
 }
 
 func (l *logAdapter) Printf(format string, v ...any) {


Test patch: