Kind: Introduce a logging shim

Created on 16 Dec 2018  路  9Comments  路  Source: kubernetes-sigs/kind

related to #23, but distinct - we should introduce a minimal logging shim interface / package, with a default instance. This will let consumers of the libraries shim the logging to their preferred package or even just dev/null it. Same goes for the status output.

We don't need anything fancy here, probably just a couple of levels like Info, Debug, Warning, Error with printf ... we can shim it to logrus for now to minimize the changes and improve on it over time.

cc @vincepri @liztio I think this will be a big improvement for library consumption

Also I know _everyone_ has a logging package, but that's exactly why I want a tiny shim to whatever package we actually use underneath - until there's an agreed upon interface for this we should make the smallest one reasonable so library consumers can swap in their own log impl.

/priority important-soon
/kind feature

kinfeature prioritimportant-soon

All 9 comments

This use case might be covered if we decided to switch to klog which supports logr and others output.

We actually have an open PR / issue for switching to klog but ran into some issues with that. I think maybe kind can actually provide an even smaller and more easily replaced interface, and I'd also like to dissallow things like klog.Fatal() from entering the codebase. Our code should not cause applications to exit.

I'm also not super convinced that these frameworks are suited as well to CLI vs servers, but I'd happily switch to klog / logr or a small shim over them to get along with the rest of the ecosystem if we can get it working well. 馃憤

I think klog might be valuable especially when using kind as a library. I agree that Fatal() or Panic() shouldn't be allowed. That could be disallowed in CI or through PRs / contribution guidelines.

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

/remove-lifecycle rotten

/assign
/lifecycle active

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

this is done!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

figo picture figo  路  3Comments

patvdleer picture patvdleer  路  4Comments

ivanayov picture ivanayov  路  4Comments

nielsvbrecht picture nielsvbrecht  路  3Comments

mithunvikram picture mithunvikram  路  4Comments