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

fix: service logs flag exclusivity #2641

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

christophercampbell
Copy link
Contributor

Description

This PR changes service logs to check exclusivity on --follow and --num. To do this the default value for --num is set to 0. The underlying flag parser does not expose whether the flags exist on the command line

@tedim52

Is this change user facing?

YES

@christophercampbell christophercampbell changed the title Cli logs check flags fix: service logs flag exclusivity Jan 30, 2025
@tedim52
Copy link
Contributor

tedim52 commented Jan 30, 2025

Thanks for the contribution! Holding on merging anything till we resolve a release issue but will review in the meantime.

Although I feel-n and -f are compatible. IMO - the behavior with -n and -f set on service logs is, say -n=100, the command should retrieve the most recent 100 logs, and then after that continue to follow logs. That's actually the current the behavior with service logs - -n by default is set to 200 - so when doing service logs -f - the behavior is to get the most recent 200 logs - and then continue to follow. Do you think that behavior causes friction in anyway/if so can you tell me more about why? LMK what you think.

@christophercampbell
Copy link
Contributor Author

The problem with -n > 0 is I could not find a way of determining the presence of the flag otherwise. The flag library does not expose the difference between a user supplying a value and the default value. So I could not figure out if user supplied -f and -n intentionally otherwise.

I do see your point about last N, then follow. But in that case it seems -n should be 0 by default anyway?

@tedim52
Copy link
Contributor

tedim52 commented Feb 6, 2025

ahh makes sense - do you think -n should always be 0 by default or only if -f is set?

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.

2 participants