Re:Go 1.21 Released
by kiitos on Thursday August 10, 2023 @04:28PM
(#37081322)
There is obviously an enormous difference between "don't let performance influence your API (to become awkward or nonidiomatic)" and "ignore performance when designing your API".
[ Parent
| on HN ]
But you've offered no actual criteria why the API is bad! Again, most logging users want something to handle nested record contexts for them and per-level methods, most logging implementers want a minimum number of entry points, and that's exactly what this API offers. (It's definitely not zerolog-style where it sacrifices ease of use for performance.)
Structured logging means logging where discrete events are sets of key=val pairs, and nothing more.
What is a record context? What is a level? These are concepts built on top of a structured logger, which manifest as specific key=val pairs in a given structured log event. They don't need -- and shouldn't have! -- first-order representation in a low-level structured logger API.
What is an entry point? If I'm writing some structured logger implementation, I expect that I should need to provide precisely one method:
func (x *MyThing) Log(<set of key=val pairs>) error
Anything more is cruft.