|
|
|
|
|
by lsaferite
1035 days ago
|
|
Given your example of log.Printf("failed to frob %s: %s", thing, error)
Wouldn't you just want to use slog.Error("failed to frob", thing, error)
That keeps the _value_ of `thing` as the key and the _value_ of `error` as the value. That would keep more in line with your first example. |
|
If "thing" were a variable with a small cardinality (like a class name or an enumeration), that might change matters. But I'd still be reluctant to do that; having the two values available in separate fields, rather than as a single key/value pair, is a lot more flexible.