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
WIP: structured error, funcr.PseudoStruct #361
base: main
Are you sure you want to change the base?
Conversation
This special type can be used in WithValues/Info/Error or as result of MarshalLog. It gets rendered like a struct, with curly brackets around the content.
A "structured error" is an error type that implements both Error and MarshalLog. It gets logged like a normal error with "err=<Error()>", but then another "errDetails=<MarshalLog()>" gets added to log additional information that may be stored in the error. The result of MarshalLog is logged like any other value. Beware that rendering of structs, in particular multi-line strings in structs, is not very readable because it all gets handled by `fmt.Sprintf`. To get nicer output of multiple values, a logr.KeysAndValues can be returned. Those values than are formatted one-by-one by klog, which means that multi-line strings are readable.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pohly The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/assign @harshanarayana |
@pohly: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
/remove-lifecycle rotten Waiting for slog in Go 1.21. |
We could do this now, but I'd like to hear from @tallclair first whether this feature is really needed and going to be used. |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
What this PR does / why we need it:
Nicer formatting of error details.
Which issue(s) this PR fixes:
Fixes #357
Special notes for your reviewer:
This is a variant of the idea with the existing funcr.PseudoType.
Release note: