fix(log): fix panic when log with nil val#3145
Conversation
f29dfe3 to
15eeaac
Compare
andynog
left a comment
There was a problem hiding this comment.
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
andynog
left a comment
There was a problem hiding this comment.
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? |
replace
Stringer.Stringwithfmt.Sprintfto for log val stringerPR checklist
.changelog(we use unclog to manage our changelog)docs/orspec/) and code comments