forked from rs/zerolog
/
encoder_json.go
216 lines (162 loc) · 4.51 KB
/
encoder_json.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
// +build !binary_log
package zerolog
// encoder_json.go file contains bindings to generate
// JSON encoded byte stream.
import (
"strconv"
"time"
"github.com/rs/zerolog/internal/json"
)
func appendInterface(dst []byte, i interface{}) []byte {
return json.AppendInterface(dst, i)
}
func appendKey(dst []byte, s string) []byte {
return json.AppendKey(dst, s)
}
func appendFloats64(dst []byte, f []float64) []byte {
return json.AppendFloats64(dst, f)
}
func appendFloat64(dst []byte, f float64) []byte {
return json.AppendFloat64(dst, f)
}
func appendFloats32(dst []byte, f []float32) []byte {
return json.AppendFloats32(dst, f)
}
func appendFloat32(dst []byte, f float32) []byte {
return json.AppendFloat32(dst, f)
}
func appendUints64(dst []byte, i []uint64) []byte {
return json.AppendUints64(dst, i)
}
func appendUint64(dst []byte, i uint64) []byte {
return strconv.AppendUint(dst, uint64(i), 10)
}
func appendUints32(dst []byte, i []uint32) []byte {
return json.AppendUints32(dst, i)
}
func appendUint32(dst []byte, i uint32) []byte {
return strconv.AppendUint(dst, uint64(i), 10)
}
func appendUints16(dst []byte, i []uint16) []byte {
return json.AppendUints16(dst, i)
}
func appendUint16(dst []byte, i uint16) []byte {
return strconv.AppendUint(dst, uint64(i), 10)
}
func appendUints8(dst []byte, i []uint8) []byte {
return json.AppendUints8(dst, i)
}
func appendUint8(dst []byte, i uint8) []byte {
return strconv.AppendUint(dst, uint64(i), 10)
}
func appendUints(dst []byte, i []uint) []byte {
return json.AppendUints(dst, i)
}
func appendUint(dst []byte, i uint) []byte {
return strconv.AppendUint(dst, uint64(i), 10)
}
func appendInts64(dst []byte, i []int64) []byte {
return json.AppendInts64(dst, i)
}
func appendInt64(dst []byte, i int64) []byte {
return strconv.AppendInt(dst, int64(i), 10)
}
func appendInts32(dst []byte, i []int32) []byte {
return json.AppendInts32(dst, i)
}
func appendInt32(dst []byte, i int32) []byte {
return strconv.AppendInt(dst, int64(i), 10)
}
func appendInts16(dst []byte, i []int16) []byte {
return json.AppendInts16(dst, i)
}
func appendInt16(dst []byte, i int16) []byte {
return strconv.AppendInt(dst, int64(i), 10)
}
func appendInts8(dst []byte, i []int8) []byte {
return json.AppendInts8(dst, i)
}
func appendInt8(dst []byte, i int8) []byte {
return strconv.AppendInt(dst, int64(i), 10)
}
func appendInts(dst []byte, i []int) []byte {
return json.AppendInts(dst, i)
}
func appendInt(dst []byte, i int) []byte {
return strconv.AppendInt(dst, int64(i), 10)
}
func appendBools(dst []byte, b []bool) []byte {
return json.AppendBools(dst, b)
}
func appendBool(dst []byte, b bool) []byte {
return strconv.AppendBool(dst, b)
}
func appendError(dst []byte, e error) []byte {
return json.AppendError(dst, e)
}
func appendErrors(dst []byte, e []error) []byte {
return json.AppendErrors(dst, e)
}
func appendString(dst []byte, s string) []byte {
return json.AppendString(dst, s)
}
func appendStrings(dst []byte, s []string) []byte {
return json.AppendStrings(dst, s)
}
func appendDuration(dst []byte, t time.Duration, d time.Duration, fmt bool) []byte {
return json.AppendDuration(dst, t, d, fmt)
}
func appendDurations(dst []byte, t []time.Duration, d time.Duration, fmt bool) []byte {
return json.AppendDurations(dst, t, d, fmt)
}
func appendTimes(dst []byte, t []time.Time, fmt string) []byte {
return json.AppendTimes(dst, t, fmt)
}
func appendTime(dst []byte, t time.Time, fmt string) []byte {
return json.AppendTime(dst, t, fmt)
}
func appendEndMarker(dst []byte) []byte {
return append(dst, '}')
}
func appendLineBreak(dst []byte) []byte {
return append(dst, '\n')
}
func appendBeginMarker(dst []byte) []byte {
return append(dst, '{')
}
func appendBytes(dst []byte, b []byte) []byte {
return json.AppendBytes(dst, b)
}
func appendArrayStart(dst []byte) []byte {
return append(dst, '[')
}
func appendArrayEnd(dst []byte) []byte {
return append(dst, ']')
}
func appendArrayDelim(dst []byte) []byte {
if len(dst) > 0 {
return append(dst, ',')
}
return dst
}
func appendObjectData(dst []byte, src []byte) []byte {
return json.AppendObjectData(dst, src)
}
func appendJSON(dst []byte, j []byte) []byte {
return append(dst, j...)
}
func appendNil(dst []byte) []byte {
return append(dst, "null"...)
}
func decodeIfBinaryToString(in []byte) string {
return string(in)
}
func decodeObjectToStr(in []byte) string {
return string(in)
}
func decodeIfBinaryToBytes(in []byte) []byte {
return in
}
func appendHex(in []byte, val []byte) []byte {
return json.AppendHex(in, val)
}