-
-
Notifications
You must be signed in to change notification settings - Fork 545
fix: don't use stdout for logs #1207
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
Conversation
If you would consider this change too much, less obtrusive variant would be replace it only for warn (and possibly info), and leave log method outputting to stdout. |
commit: |
I guess it depends on exactly what output we're talking about. Not ALL logging must go to
I would agree that the first line with the warning should not go to
There's a separate The default mode will ask feedback from the user and print changelog, etc. - this could go to
It's a bit much indeed, but the good thing is that your timing is great as we're heading towards a new v19 which could introduce potentially breaking changes like this. Please consider this my initial review, I'll give it a closer look when I can. |
OK, so proposed variant would be: Log warnings and info to stderr, but This should work fine in CI, since commands that are useful in shell scripts should not use |
Sounds like a plan to me! 👍 I won't have time today to review or work on things, but certainly within a few days. |
Pushed updated version, plus I've added |
console.log(version); | ||
process.exit(0); | ||
if (version) { | ||
console.log(version); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I like the idea and result of this all, here's a bit of a nitpick: why not use the Log
class here anymore? In my mind, the Log
class for logging, to abstract away stdout
vs stderr
and no need to use console.*
directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it is not logging, its direct output of the command. But it does not really matter, I did the changes incrementally, and with final version, its not needed to modify this file anymore.
Don't use console.log for logging diagnostic, as it outputs to stdout instead of stderr, and is not compatible with shell usage.
Fixed conflicts after merging another branch to main. |
Thanks, Michal! Much appreciated. |
🚀 This pull request is included in v19.0.0-next.2. See Release 19.0.0-next.2 for release notes. |
Don't use console.log for logging, as it outputs to stdout instead of stderr.
When used from scripts, it is impossible to use e. g.
release-it --release-version --increment major
with conventional-changelog, because that outputsinstead of two streams, and version only in stdout.
I've checked that
--release-version
and--changelog
arguments already use (correctly)console.log
directly, and I've replaced log for cli commands.