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

Make corral less verbose #137

Merged
merged 2 commits into from
Jun 18, 2020
Merged

Make corral less verbose #137

merged 2 commits into from
Jun 18, 2020

Conversation

hasheddan
Copy link
Member

This updates most non-log prints to stdout to have a log level of fine
such that they will only be displayed when the --verbose flag is passed.
Some commands are ommitted from this change, such as info, version, and
list as their explicit purpose is to print information.

Fixes #101

Signed-off-by: hasheddan georgedanielmangum@gmail.com

@hasheddan
Copy link
Member Author

Noticed #133 after opening this. I am happy to hold and rebase until after that is merged, or scrap this PR if that one intends to address this issue as well 👍

@hasheddan
Copy link
Member Author

Looks like tests will also need to be updated as they are evaluating the old output

@SeanTAllen
Copy link
Member

I would say, make the tests work with new output and let's start a discussion in the #tooling stream on zulip to find better test to replace the brittle output tests.

@SeanTAllen
Copy link
Member

@hasheddan #133 is unrelated.

@hasheddan
Copy link
Member Author

@SeanTAllen I just updated the failing tests to run with --verbose as a short-term solution

@SeanTAllen
Copy link
Member

Seems like a good idea.

Can you open an issue that details which tests are using the output so we can start working out replacements?

@hasheddan
Copy link
Member Author

@SeanTAllen sure thing!

@SeanTAllen SeanTAllen added the changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge label Jun 15, 2020
@SeanTAllen
Copy link
Member

Rather than changing the log level to fine, I think that by default only verbosity with existing logger should be LvlErrr, you'd have to ask for anything lower than that to be displayed.

And when #133 is done, the default logger level would be Error.

This would fit with the general command line tool idea of "by default, only print errors".

@Theodus thoughts?

@SeanTAllen SeanTAllen requested a review from Theodus June 15, 2020 01:44
@SeanTAllen SeanTAllen added changelog - added Automatically add "Added" CHANGELOG entry on merge changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge changelog - changed Automatically add "Changed" CHANGELOG entry on merge and removed changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge changelog - added Automatically add "Added" CHANGELOG entry on merge labels Jun 15, 2020
@hasheddan
Copy link
Member Author

@SeanTAllen that makes sense 👍 My reasoning for changing to fine here was due to the fact that commands like version are being passed the same logger for writing to stdout, and we want those to print info level by default (as their purpose is printing information to the user). Agree this is a bit of a rough workaround to make that happen

@hasheddan
Copy link
Member Author

Dropping a note here from Pony sync call this week: instead of changing these log levels across the board, we could pass a different logger for "informational commands" and let --verbose behave differently on those. That would mean that non-informational commands would not print anything unless --verbose was supplied, and informational commands would print whether --verbose was supplied or not. Note that for informational commands that would mean providing --verbose would have mostly no effect.

Any thoughts on this @SeanTAllen?

@SeanTAllen
Copy link
Member

What's an informational command?

@hasheddan
Copy link
Member Author

version, info, list, etc.. any command that has an explicit purpose of printing information

@SeanTAllen
Copy link
Member

So fetch, init, update are "non-informational", anything else non-informational?

@hasheddan
Copy link
Member Author

I would say remove, add, clean, run would be categorized as non-informational.

@SeanTAllen
Copy link
Member

@hasheddan This sounds very reasonable.

@hasheddan
Copy link
Member Author

@SeanTAllen nice! I will update and ping you later this evening when ready for another review 👍

This passes a different logger for informational commands (commands that
have the explicit purpose of printing output) and executing commands
(commands that perform an action other than printing output). Executing
commands should not print output unless a --verbose flag is passed.
Informational commands should print output whether a --verbose flag is
provided or not.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
This is a temporary workaround for satiating fetch and update tests that
require checking text printed to std out.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Copy link
Member Author

@hasheddan hasheddan left a comment

Choose a reason for hiding this comment

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

@SeanTAllen Did a quick refactor here. It seems to fix the problem we are trying to address, but I don't think it is our ultimate final state. Let me know if you want additional work here before merge :)

@@ -48,5 +50,5 @@ actor Main

// Hand off to Executor to resolve required dirs and execute the command
Executor.execute(
command, env, log, uout,
command._1, env, log, command._2,
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure how elegant this is in Pony vernacular. Seems like it might be worth refactoring the Executor in the future, but this felt like the lower friction move for now. Happy to adjust if you prefer another pattern 👍

@SeanTAllen
Copy link
Member

@hasheddan My statement: it fixes a problem. Yeah, we don't want this as a final state. I think a better "closer to final" state is for each command "carry" the "logger" with it.

Commands are really anemic at this point. I think it makes sense for when a command is created for this log level to be set.

Perhaps there is a trait for an informational vs action command that each command will implement and it can then somehow "select" the correct logging.

Otoh, that might be really ugly.

Can you open an issue for this to be cleaned up more?

Rather than "just fixing" that issue, I'd like to see it done as part of writing tests to replace the ones that you had to modify to make this pass. I think if we have tests like

"Fetch will only output if X" and "Fetch won't output when Y" then we will end up at a good solid testable design, does that sound good to you? If yes, I'm good with merging this once you have opened that issue/updated #138 to incorporate these additional notes.

@hasheddan
Copy link
Member Author

@SeanTAllen done 👍 #140

@SeanTAllen SeanTAllen merged commit 9f1dfbf into ponylang:master Jun 18, 2020
@SeanTAllen
Copy link
Member

Thanks @hasheddan!

github-actions bot pushed a commit that referenced this pull request Jun 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - changed Automatically add "Changed" CHANGELOG entry on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Corral is too verbose
2 participants