You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there an existing issue already for this feature request/idea?
I have searched for an existing issue, and could not find anything. I believe this is a new feature request to be evaluated.
What problem is this feature going to solve? Why should it be added?
The plugin helper machinery hides the zap.Logger and all means of configuring it: It doesn't hook the Zap CLI options nor any env-vars. No means to control log format, json logging etc is provided.
There's only the plugin --debug flag.
Describe the solution you'd like
It would be helpful to be able to provide a plugin startup hook that can configure the logger etc, overriding the defaults here.
Otherwise each entrypoint into the plugin implementation has to reconfigure logging, and still can't influence the logging done by the helper itself.
Describe alternatives you've considered
I didn't really find any, since there doesn't seem to be a sensible means of unwrapping the logr.Logger to obtain the underlying zap root logger.
Additional context
No response
Are you willing to actively contribute to this feature?
No
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
I fixed this in #31 . It's now possible to do this by injecting a logger into the Cobra command's initial Context, using something like this in cmd/plugin/plugin.go's NewCmd():
// Replace the pluginhelper's logging implementation with one that
// injects a stack on panic.
ctx := cmd.Context()
if ctx == nil {
ctx = context.Background()
}
cmd.SetContext(newLogContext(ctx))
It might not be the cleanest approach, but it works. It could use documentation, so I won't close the ticket now, the helper likely needs a hint about how to do it added somewhere.
Is there an existing issue already for this feature request/idea?
What problem is this feature going to solve? Why should it be added?
The plugin helper machinery hides the
zap.Logger
and all means of configuring it: It doesn't hook the Zap CLI options nor any env-vars. No means to control log format, json logging etc is provided.There's only the
plugin --debug
flag.Describe the solution you'd like
It would be helpful to be able to provide a plugin startup hook that can configure the logger etc, overriding the defaults here.
Otherwise each entrypoint into the plugin implementation has to reconfigure logging, and still can't influence the logging done by the helper itself.
Describe alternatives you've considered
I didn't really find any, since there doesn't seem to be a sensible means of unwrapping the
logr.Logger
to obtain the underlying zap root logger.Additional context
No response
Are you willing to actively contribute to this feature?
No
Code of Conduct
The text was updated successfully, but these errors were encountered: