-
Notifications
You must be signed in to change notification settings - Fork 784
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
Access check & logging framework refactor & update code-gen version #750
Conversation
shivdudhani
commented
Mar 18, 2020
•
edited
edited
- use a logging interface for logs (fixes Update the logging framework #742)
- update code-generator version and instructions to run (fixes [BUG] Update instructions for code-generator #743)
- add selfReviewAccess check for generate rules. (fixes [BUG] Policy validation for custom Kyverno cluster / roles #714)
Added instructions to run code-generator at https://github.com/nirmata/kyverno/wiki/Building |
Pending: Add instructions to change the verbosity of logs as a command-line argument. |
It's a huge PR, gonna need help from @shravanshetty1 to review :) |
Is this going to be added to this PR? |
The documentation for setting in a part of Wiki, so will not be in this PR.
|
@shivdudhani Can you please add the link to Wiki once you have it? |
Updated logging docs: |
fixes #649 |
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.
@shivdudhani @realshuting
I feel like instead of injecting loggers into each and every function - we should have a logger global variable for each package. Loggers are generally used this way.
We are still able to say who generated the logs since each package will have a log with unique name.
In this PR we are just moving to a new framework for logging. The previous implementation was not modified. Previously we didn't have options to provide context for debugging, but with this we do. Log provides Instead of using global variables in a package, it would be better to have each struct manage its own to logs. If the logs are not to be passed, then the generic/base implementation of the log can be used. The pkg |
That makes sense. We could make this an ongoing change like godoc comments - this has to be documented in the contributor docs though. |
I didn't understand the comment A developer can use the logging framework they want, as long as the logs provides details for debugging. Storing the logger interface as a variable in a struct or passed as a function parameter is up to the design. The idea of building context is based on the |
we can add logger in reciever of methods (functions with reciever arguments). However for normal function (no reciever arguments) we should use base logs. |