Commit 2d61f44
committed
slog: remove Attr.AppendValue
Attr.AppendValue was originally intended to be a convenient and more
efficient way of formatting Attr values. But there is no one clearly
right way to format them, and the efficiency argument doesn't
really hold water: AppendValue skips the redundant but cheap type
check that occurs in
switch a.Kind() {
case IntKind:
... a.Int() ..
but then formats Times and Durations as strings instead of integers.
We keep it internally to help out in a couple of places, but overall
it's better if Handler implementations do their own value formatting.
For casual use, fmt.Sprint(a.Value()) is fine.
Change-Id: Ie265f1ee5daf5f8002bfc2b70f4bf461cb07a10b
Reviewed-on: https://go-review.googlesource.com/c/exp/+/430098
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>1 parent d6a8ba4 commit 2d61f44
4 files changed
+5
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
282 | | - | |
| 282 | + | |
283 | 283 | | |
284 | | - | |
| 284 | + | |
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| |||
0 commit comments