go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

Optimize logging for ContextWithFields.

Open kevwan opened this issue 4 months ago • 3 comments

  • [ ] call processFieldValue once even write logs with the same context for multiple times.

kevwan avatar Aug 08 '25 12:08 kevwan

Do you need someone to implement it? If so, you can assign this task to me. @kevwan

NicoleRobin avatar Aug 14 '25 16:08 NicoleRobin

Do you need someone to implement it? If so, you can assign this task to me. @kevwan

Thanks for your contribution!

kevwan avatar Aug 15 '25 01:08 kevwan

I've looked at the logic of the function processFieldValue. It is used to process fields when calling log functions like Debug and Info. For the fields stored in the context using the ContextWithFields function, the processFieldValue function is indeed called repeatedly. Is the intention here to call processFieldValue during the call to ContextWithFields for processing, and then save the result, so as to avoid repeated processing later? @kevwan

NicoleRobin avatar Aug 24 '25 16:08 NicoleRobin