Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common/loggers: Write PrintTimerIfDelayed output to stdErr #13171

Closed
jmooring opened this issue Dec 19, 2024 · 2 comments · Fixed by #13172
Closed

common/loggers: Write PrintTimerIfDelayed output to stdErr #13171

jmooring opened this issue Dec 19, 2024 · 2 comments · Fixed by #13172
Assignees
Milestone

Comments

@jmooring
Copy link
Member

jmooring commented Dec 19, 2024

In #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.

defer c.logger.PrintTimerIfDelayed(time.Now(), "hugo: collected modules")

// PrintTimerIfDelayed prints a time statement to the FEEDBACK logger
// if considerable time is spent.
func (l *logAdapter) PrintTimerIfDelayed(start time.Time, name string) {
elapsed := time.Since(start)
milli := int(1000 * elapsed.Seconds())
if milli < 500 {
return
}
l.Printf("%s in %v ms", name, milli)
}

Can we replace the last line in the above with this?

fmt.Fprintf(l.stdErr, "%s in %v ms", name, milli)
@bep
Copy link
Member

bep commented Dec 19, 2024

fmt.Fprintf(l.stdErr, "%s in %v ms", name, milli)

Yes. I will do a patch release, possibly Monday.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants