fix: use flagset when initializing klog#6329
Conversation
When using kargo as a library, logger will initialize klog in the init() function with default flagset. This means that if any other tool initializes the klog with default flagset in the main() function, that will panic with `flag redefined` error. klog recommends calling `InitFlags` in `main()` or using flagset, going for the second option here. Signed-off-by: Daniil Fedotov <[email protected]>
✅ Deploy Preview for docs-kargo-io ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Automated Policy NoticeThis pull request has been converted to a draft because it does not reference an unblocked issue. Maintainers do not routinely review drafts. All contributions to Kargo require a linked, unblocked issue. This ensures that proposed changes have been reviewed by maintainers before effort is invested. To move forward:
See the Contributor Guide for full details. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6329 +/- ##
=======================================
Coverage 58.05% 58.05%
=======================================
Files 499 499
Lines 41748 41749 +1
=======================================
+ Hits 24238 24239 +1
Misses 16050 16050
Partials 1460 1460 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@hairyhum you're supposed to be exempt from the PR policy. Not sure what happened, but I will find out and fix it. |
EronWright
left a comment
There was a problem hiding this comment.
LGTM, but let me wait for non-draft
Issue Reference
NA
Description
When using kargo as a library, logger will initialize klog in the init() function with default flagset. This means that if any other tool initializes the klog with default flagset in the main() function, that will panic with
flag redefinederror.klog recommends calling
InitFlagsinmain()or using a flagset. This PR uses a "kargo_logger" flagset forInitFlagsChecklist
kind/proposal,needs discussion,needs research,maintainer only,area/security,size/large,size/x-large,size/xx-large).AI Use Disclosure
Select one:
Sign-Off
git commit -s) (required)git commit -S) (encouraged)