-
Notifications
You must be signed in to change notification settings - Fork 468
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
fix(log): fix panic when log with nil val #3145
Conversation
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.
Thanks @0xfocus ❤️
f29dfe3
to
15eeaac
Compare
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.
lgtm. Did some diff testing on cometbft log output with the new code and old code, even though the log might not come in the same order, everything seems to be logging the same.
Thanks @0xfocus, could you please take a look at the lint check? |
d3250fb
to
53ddea3
Compare
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.
Could you please provide a changelog entry in this PR? If you check other PRs you will be able to see how to create one in the unreleased folder.
Thanks @0xfocus, this is ready to merge but noticed there's no changelog entry. Also, just for additional context, Since there're no issue associated with this, I'd like more context on the issue in particular when you would get a panic for logging a nil val. Just trying to understand the use case. We might backport this change to older releases but I'm finding interesting the use cases when this panic would be caused. I'd assume that since this piece of code is present even in very older releases, if something would cause a panic when logging I'd assume that this would have surfaced a long time ago. Please let us know. Thanks ! |
replace `Stringer.String` with `fmt.Sprintf` to for log val stringer
f2c9604
to
0b124be
Compare
In my case, I want to log a Hash struct pointer, sometimes the pointer is nil, so the panic happend
|
Hi, @andynog, Is there any problem in this PR? |
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.
add changelog entry for #3145
replace
Stringer.String
withfmt.Sprintf
to for log val stringerPR checklist
.changelog
(we use unclog to manage our changelog)docs/
orspec/
) and code comments