-
Notifications
You must be signed in to change notification settings - Fork 5.3k
logging: clarify error logging #8686
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
base: master
Are you sure you want to change the base?
Conversation
5b58828 to
d9ad77a
Compare
The main purpose of error logging is informing admins about problems. Our logging libraries are not configured to log additional debug information for errors. Producing an error log before returning an error is usually wrong. runtime.HandleErrorWithContext and runtime.HandleErrorWithLogger were not mentioned even though they are meant to be used in certain places.
|
/assign @deads2k |
| Whenever possible, use this instead of normal error logging at the top of a call chain, i.e. the place where code | ||
| cannot return an error up to its caller, if there is no other way of handling the error (like logging it | ||
| and then exiting the process). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great advice, thanks.
lgtm. I'll leave it open for others to comment, but if it's still open in a week or two remind me and I'll tag for merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dashpole, pohly The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
The main purpose of error logging is informing admins about problems. Our logging libraries are not configured to log additional debug information for errors.
Producing an error log before returning an error is usually wrong.
runtime.HandleErrorWithContext and runtime.HandleErrorWithLogger were not mentioned even though they are meant to be used in some places.