We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0ac48ad commit d8c5704Copy full SHA for d8c5704
slog.go
@@ -25,6 +25,14 @@ type Value interface {
25
LogValue() interface{}
26
}
27
28
+// ValueFunc is a convenient function wrapper around Value.
29
+type ValueFunc func() interface{}
30
+
31
+// LogValue implements Value.
32
+func (v ValueFunc) LogValue() interface{} {
33
+ return v()
34
+}
35
36
type componentField string
37
38
func (c componentField) LogKey() string { panic("never called") }
slogval/reflect.go
@@ -16,7 +16,6 @@ import (
16
// that would like to only use the reflection based
17
// converter for itself and ignore interfaces like error
18
// or fmt.Stringer.
19
-// TODO add back ValueFunc
20
type Reflector interface {
21
LogWithReflect()
22
0 commit comments