3 ms·
> It's a little magical that "user" is a key. So what if you have multiple key-value pairs? You... add them afterwards? It's really just a plist (https://www.g
by masklinn 3y ago
> It's a little magical that "user" is a key. So what if you have multiple key-value pairs?
You... add them afterwards? It's really just a plist (https://www.gnu.org/software/emacs/manual/html_node/elisp/Property-Lists.html https://www.gnu.org/software/emacs/manual/html_node/elisp/Pr...), that's hardly novel. The method takes any number of parameters and pairs them up as key, value.
Or if you really hate yourself, you use LogAttrs with explicitly constructed Attr objects.
> I really like Pythons approach where you can have user="value" it makes things a bit more clear.
The trouble is, Go doesn't have keyword parameters so that doesn't work.
- radlad 3y agoIt sure has maps though... logrus famously uses `logrus.Fields{"key": "value"}`
- morelisp 3y agoAnd logrus is one of the slowest loggers by far, in part because of its heavy map usage.
- deleted 3y ago[deleted]
- dgsb 3y agoIt's also the reflect on the value part which slows down things. It could be improved but it's hard to do that without breaking interface. It's so widely used that a major bump wouldn't that useful.
- JonChesterfield 3y agoI'd expect it to be mostly called on map literals, at least a compile time constant set of keys. That should be amenable to a targeted compiler optimisation.