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

Log progress to standard output, not standard error #929

Closed
olliefr opened this issue May 4, 2021 · 2 comments
Closed

Log progress to standard output, not standard error #929

olliefr opened this issue May 4, 2021 · 2 comments

Comments

@olliefr
Copy link

olliefr commented May 4, 2021

Is your feature request related to a problem? Please describe.
When swag init is run by goreleaser in a CI/CD pipeline, swag outputs progress messages into the standard error stream, making goreleaser think that they are error messages:

image

What goreleaser does makes sense - after all how would it know it's not an error, if it's being output to stderr?

Describe the solution you'd like
It would be useful, if log messages did not go to standard error, unless they are about an error.

Describe alternatives you've considered
Can't think of any that would deliver satisfactory result. Disabling log output altogether means errors would be easy to miss and harder to debug.

Additional context
I had a look at swag codebase, and I can see that it is using Go standard library log module whose use is wrapped in a custom Println function. Perhaps, there could be two custom functions instead - one for logging errors and another for logging the progress? They would output to stderr and stdout, respectively. I'm open to other solutions as well.

The scope of proposed change seems to be minor, I can have a go at a PR, if you are happy with this? I'm open to a discussion and other approaches as well.

Cheers! 🙃 :shipit:

@ubogdan
Copy link
Contributor

ubogdan commented Jul 27, 2021

Hi @olliefr,
I perfectly understand the issue and I agree it will be a nice improvement. The solution to having 2 different loggers sounds good to me. Looking forward for your implementation.

@ubogdan
Copy link
Contributor

ubogdan commented Sep 28, 2021

Implemented in v1.7.2.

@ubogdan ubogdan closed this as completed Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants