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

Add flag for debug logs #1166

Merged
merged 3 commits into from Jul 2, 2019
Merged

Add flag for debug logs #1166

merged 3 commits into from Jul 2, 2019

Conversation

anyasabo
Copy link
Contributor

Adds a distinct log level flag to enable debug logs (rather than as part of the development flag), as part of #305

I wasn't sure if we wanted a flag or env var, so I followed how it was previously set up. Definitely open to changing it. Modifying env vars (or a env vars via a config map) feels slightly preferable but I don't feel strongly either way.


cobra.OnInitialize(func() {
logf.SetLogger(logf.ZapLogger(dev.Enabled))
level, _ := rootCmd.Flags().GetString(logLevelFlag)
logLevel := false
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I would tend to name the logLevel boolean variable enableDebugLevel instead of logLevel to better reflect what it does and then name level in logLevel.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about that but wasn't sure if we might want to have a separate debug mode (maybe enabling profiling if we're not already?). That's not a very persuasive argument though so I'm good with changing it

operators/cmd/main.go Outdated Show resolved Hide resolved
Copy link
Contributor

@sebgl sebgl left a comment

Choose a reason for hiding this comment

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

LGTM

@anyasabo anyasabo merged commit ccf1a6d into elastic:master Jul 2, 2019
@anyasabo anyasabo deleted the debuglog branch July 2, 2019 13:06
@pebrc pebrc added v0.9.0 >enhancement Enhancement of existing functionality labels Jul 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement Enhancement of existing functionality v0.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants