-
Notifications
You must be signed in to change notification settings - Fork 214
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
Set log level through function #389
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: tshiyuoo The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
We've discussed this before. Please read up on #336 and if you are interested in adding a non-flag API, then do it as described there. Adding individual new API calls in the main klog is not how we want to do this. |
@@ -438,6 +438,11 @@ func InitFlags(flagset *flag.FlagSet) { | |||
}) | |||
} | |||
|
|||
// SetVerbosity set log level through function. | |||
func SetVerbosity(level Level) { | |||
logging.verbosity = 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.
This isn't thread-safe. Set
has to be used.
/assign @pohly |
/close Please reopen a new PR with the approach described above, if you are interested. |
@pohly: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What this PR does / why we need it:
Which issue(s) this PR fixes:
The log level can be set through functions,
Not only can it be set by flags, but also by functions.
A app has a debug flag. enable the debug flag parameter, I hope that all the klog logs can be printed out.
But the klog log level can only be set through flag
Special notes for your reviewer:
Release note: