-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
log/zap: Allow configuring formatter independently of debug
option
#442
Comments
/kind feature |
/help |
@DirectXMan12: Please ensure the request meets the requirements listed here. If this request no longer meets these requirements, the label can be removed 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. |
@alvaroaleman @DirectXMan12 made some changes to make this configurable. #467 Still WIP as I need to modify the LoggerTo from other places as well if we are looking to change it dynamically. One question here, how are we deciding when to use console encoder and when not? |
By default, it was debug vs non-debug, but I think we need to start considering how we want to expose these options. |
@DirectXMan12 can't we use existing controller-runtime/pkg/log/zap/zap.go Lines 33 to 35 in 71cdf35
|
The development flag control also controls output format (human-readable vs json), so we need more granular options. |
Perhaps we should adopt the "functional options" style here too. |
Right now, the formatter/encoder of the
log/zap
package is inferred from thedebug
option, if its enabled a console encoder is used, otherwise a json encoder. This does not always make sense, e.G. sometimes debug log may help in production, but that should not result in unstructured logging.It would be awesome, if another option was added to
RawLoggerTo
to make this configurable. Alternatively, we could use a different type foropts
that contains an option for the encoder.The text was updated successfully, but these errors were encountered: