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

Use logrus instead of direct output to stderr #11996

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

felixfontein
Copy link
Contributor

What I did
There are two warnings on stderr that --progress json (#11478) still emits as plain text. This is because they are printed there directly, without using logrus or the events framework.

This PR changes these places to use logrus.Warnf(...) instead of fmt.Fprintf(s.stderr(), ...).

Related issue
Ref: #11478 (not an issue, but a PR)

@felixfontein
Copy link
Contributor Author

@cmrigney @ndeloof you might also be interested in this PR since it avoids more free-form stderr text in case the JSON stream progress writer is used.

@@ -180,7 +182,7 @@ func (s *composeService) doBuildClassic(ctx context.Context, project *types.Proj
aux := func(msg jsonmessage.JSONMessage) {
var result dockertypes.BuildResult
if err := json.Unmarshal(*msg.Aux, &result); err != nil {
fmt.Fprintf(s.stderr(), "Failed to parse aux message: %s", err)
logrus.Warnf("Failed to parse aux message: %s", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be Errorf

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, adjusted it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants