Skip to content
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

Log with field error instead of err #7998

Merged
merged 4 commits into from
Dec 1, 2020

Conversation

potuz
Copy link
Contributor

@potuz potuz commented Nov 30, 2020

What type of PR is this?

Small enhancement

What does this PR do? Why is it needed?

It changes the field logged in some initial sync warnings from "err" to "error", this reduces slightly the footprint on the journal and simplifies a bit log-parsing scripts.

Which issues(s) does this PR fix?

None filed.

@potuz potuz requested a review from a team as a code owner November 30, 2020 12:18
terencechain
terencechain previously approved these changes Nov 30, 2020
Copy link
Member

@prestonvanloon prestonvanloon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR! The log consistency is appreciated!

With Logrus, WithError is the preferred way to handle errors. It's essentially an alias for the code you've written, except for the last message which isn't an "error" type.

https://godoc.org/github.com/sirupsen/logrus#WithError

beacon-chain/sync/initial-sync/round_robin.go Outdated Show resolved Hide resolved
beacon-chain/sync/initial-sync/round_robin.go Outdated Show resolved Hide resolved
beacon-chain/sync/initial-sync/round_robin.go Outdated Show resolved Hide resolved
beacon-chain/sync/initial-sync/round_robin.go Outdated Show resolved Hide resolved
@potuz
Copy link
Contributor Author

potuz commented Nov 30, 2020

Thanks for this PR! The log consistency is appreciated!

With Logrus, WithError is the preferred way to handle errors. It's essentially an alias for the code you've written, except for the last message which isn't an "error" type.

https://godoc.org/github.com/sirupsen/logrus#WithError

Oh but I didn't write any of it just batch changed "err" for "error". Sure, your changes are perfect!

Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
prestonvanloon
prestonvanloon previously approved these changes Nov 30, 2020
@rauljordan rauljordan changed the base branch from master to develop November 30, 2020 21:37
@rauljordan rauljordan dismissed prestonvanloon’s stale review November 30, 2020 21:37

The base branch was changed.

@terencechain terencechain added Ready For Review A pull request ready for code review OK to merge labels Nov 30, 2020
@terencechain terencechain merged commit 9a1423d into prysmaticlabs:develop Dec 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review A pull request ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants