-
Notifications
You must be signed in to change notification settings - Fork 41
feat: add --quiet flag to reduce build output #607
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
base: develop
Are you sure you want to change the base?
Conversation
|
Why not just allow users to set the log level directly? |
|
@swagatbora90 I think the log level can already be controlled. What I really want here is to suppress or dramatically reduce the amount of "informational" stdout printing, which isn't all routed through a logging module. In my mind, the stdout printing is meant for user consumption and the logging is more of a diagnostic output. |
7471d2b to
104125e
Compare
Add a --quiet/-q flag that suppresses informational messages while preserving warnings and errors. Changes: - Add --quiet flag to CLI arguments - Thread quiet parameter through build and make commands - Conditionally add --quiet to cargo-make invocations - Set TWOLITER_QUIET env var for embedded tools - Adjust pubsys/testsys log levels based on quiet mode - Update init_logger to respect quiet flag In quiet mode: - Suppresses cargo-make INFO messages - Suppresses twoliter INFO logs - Sets embedded tool log levels to warn - Still shows all warnings and errors - Completely silent on successful builds Normal mode behavior is unchanged.
| PUBLISH_REPO = "default" | ||
|
|
||
| PUBLISH_LOG_LEVEL = "info" | ||
| PUBLISH_LOG_LEVEL = { script = ["if [ -n \"${TWOLITER_QUIET}\" ]; then echo warn; else echo info; fi"], condition = { env_not_set = ["PUBLISH_LOG_LEVEL"] } } |
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.
-n checks if $TWOLITER_QUIET exists. But the implementation sets "1" or "0" for it. Should we check the value here directly instead?
| .env("TWOLITER_QUIET", if global_opts.quiet { "1" } else { "0" }) | ||
| .makefile(makefile_path) | ||
| .project_dir(project.project_dir()) | ||
| .quiet(global_opts.quiet) |
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.
Q - looking at the code, it seems that the CargoMake.quiet field is not really used? Only the env var was used.
Add a --quiet/-q flag that suppresses informational messages while preserving warnings and errors.
Changes:
In quiet mode:
Normal mode behavior is unchanged.
Testing done:
--quietmodeSee this gist for a before/after comparison.
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.