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

utility function for "flush and exit" #301

Closed
pohly opened this issue Feb 17, 2022 · 1 comment · Fixed by #303
Closed

utility function for "flush and exit" #301

pohly opened this issue Feb 17, 2022 · 1 comment · Fixed by #303
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@pohly
Copy link

pohly commented Feb 17, 2022

/kind feature

Describe the solution you'd like

For the migration to structured logging, klog.Fatal is meant to be replaced with klog.ErrorS + os.Exit. However, that combination no longer flushes info messages.

We need a better recommendation and probably some new helper function in klog. For proposals, see kubernetes/kubernetes#107724 (comment)

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Feb 17, 2022
@pohly
Copy link
Author

pohly commented Mar 3, 2022

We discussed this in WG Structured Logging and propose to
use this:

var ExitFlushTimeout = 10 * time.Second
klog.Errors(...)
klog.FlushAndExit(klog.ExitFlushTimeout, 255)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants