-
Notifications
You must be signed in to change notification settings - Fork 0
/
field.go
53 lines (48 loc) · 1.25 KB
/
field.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package meerkats
import (
"encoding/json"
"github.com/opentracing/opentracing-go/log"
)
func NewField(key string, value interface{}) (f log.Field) {
return log.Object(key, value)
}
func String(key string, value string) log.Field {
return log.String(key, value)
}
func Bool(key string, value bool) log.Field {
return log.Bool(key, value)
}
func Int(key string, value int) log.Field {
return log.Int(key, value)
}
func Int32(key string, value int32) log.Field {
return log.Int32(key, value)
}
func Int64(key string, value int64) log.Field {
return log.Int64(key, value)
}
func Uint(key string, value uint) log.Field {
return log.Uint64(key, uint64(value))
}
func Uint32(key string, value uint32) log.Field {
return log.Uint32(key, value)
}
func Uint64(key string, value uint64) log.Field {
return log.Uint64(key, value)
}
func Float32(key string, value float32) log.Field {
return log.Float32(key, value)
}
func Float64(key string, value float64) log.Field {
return log.Float64(key, value)
}
func Object(key string, value interface{}) log.Field {
return log.Object(key, value)
}
func JSON(key string, value interface{}) log.Field {
s, _ := json.Marshal(value)
return log.String(key, string(s))
}
func ErrorString(err error) log.Field {
return log.Error(err)
}