-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhook_mutable.go
More file actions
318 lines (214 loc) · 7.46 KB
/
hook_mutable.go
File metadata and controls
318 lines (214 loc) · 7.46 KB
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
package logger
import (
"context"
"fmt"
"time"
"go.uber.org/zap"
)
type MutableFixedNamedField[T any] struct {
Fc func(context.Context) T
}
type MutableNamedField[T any] struct {
Key string
Fc func(context.Context) T
}
type MutableErr MutableFixedNamedField[error]
func (m *MutableErr) DoHook(ctx context.Context) Field {
return zap.Error(m.Fc(ctx))
}
type MutableErrors MutableNamedField[[]error]
func (m *MutableErrors) DoHook(ctx context.Context) Field {
return zap.Errors(m.Key, m.Fc(ctx))
}
type MutableNamedError MutableNamedField[error]
func (m *MutableNamedError) DoHook(ctx context.Context) Field {
return zap.NamedError(m.Key, m.Fc(ctx))
}
type MutableBinary MutableNamedField[[]byte]
func (m *MutableBinary) DoHook(ctx context.Context) Field {
return zap.Binary(m.Key, m.Fc(ctx))
}
type MutableBool MutableNamedField[bool]
func (m *MutableBool) DoHook(ctx context.Context) Field {
return zap.Bool(m.Key, m.Fc(ctx))
}
type MutableBoolp MutableNamedField[*bool]
func (m *MutableBoolp) DoHook(ctx context.Context) Field {
return zap.Boolp(m.Key, m.Fc(ctx))
}
type MutableByteString MutableNamedField[[]byte]
func (m *MutableByteString) DoHook(ctx context.Context) Field {
return zap.ByteString(m.Key, m.Fc(ctx))
}
type MutableComplex128 MutableNamedField[complex128]
func (m *MutableComplex128) DoHook(ctx context.Context) Field {
return zap.Complex128(m.Key, m.Fc(ctx))
}
type MutableComplex128p MutableNamedField[*complex128]
func (m *MutableComplex128p) DoHook(ctx context.Context) Field {
return zap.Complex128p(m.Key, m.Fc(ctx))
}
type MutableComplex64 MutableNamedField[complex64]
func (m *MutableComplex64) DoHook(ctx context.Context) Field {
return zap.Complex64(m.Key, m.Fc(ctx))
}
type MutableComplex64p MutableNamedField[*complex64]
func (m *MutableComplex64p) DoHook(ctx context.Context) Field {
return zap.Complex64p(m.Key, m.Fc(ctx))
}
type MutableFloat64 MutableNamedField[float64]
func (m *MutableFloat64) DoHook(ctx context.Context) Field {
return zap.Float64(m.Key, m.Fc(ctx))
}
type MutableFloat64p MutableNamedField[*float64]
func (m *MutableFloat64p) DoHook(ctx context.Context) Field {
return zap.Float64p(m.Key, m.Fc(ctx))
}
type MutableFloat32 MutableNamedField[float32]
func (m *MutableFloat32) DoHook(ctx context.Context) Field {
return zap.Float32(m.Key, m.Fc(ctx))
}
type MutableFloat32p MutableNamedField[*float32]
func (m *MutableFloat32p) DoHook(ctx context.Context) Field {
return zap.Float32p(m.Key, m.Fc(ctx))
}
type MutableInt MutableNamedField[int]
func (m *MutableInt) DoHook(ctx context.Context) Field {
return zap.Int(m.Key, m.Fc(ctx))
}
type MutableIntp MutableNamedField[*int]
func (m *MutableIntp) DoHook(ctx context.Context) Field {
return zap.Intp(m.Key, m.Fc(ctx))
}
type MutableInt64 MutableNamedField[int64]
func (m *MutableInt64) DoHook(ctx context.Context) Field {
return zap.Int64(m.Key, m.Fc(ctx))
}
type MutableInt64p MutableNamedField[*int64]
func (m *MutableInt64p) DoHook(ctx context.Context) Field {
return zap.Int64p(m.Key, m.Fc(ctx))
}
type MutableInt32 MutableNamedField[int32]
func (m *MutableInt32) DoHook(ctx context.Context) Field {
return zap.Int32(m.Key, m.Fc(ctx))
}
type MutableInt32p MutableNamedField[*int32]
func (m *MutableInt32p) DoHook(ctx context.Context) Field {
return zap.Int32p(m.Key, m.Fc(ctx))
}
type MutableInt16 MutableNamedField[int16]
func (m *MutableInt16) DoHook(ctx context.Context) Field {
return zap.Int16(m.Key, m.Fc(ctx))
}
type MutableInt16p MutableNamedField[*int16]
func (m *MutableInt16p) DoHook(ctx context.Context) Field {
return zap.Int16p(m.Key, m.Fc(ctx))
}
type MutableInt8 MutableNamedField[int8]
func (m *MutableInt8) DoHook(ctx context.Context) Field {
return zap.Int8(m.Key, m.Fc(ctx))
}
type MutableInt8p MutableNamedField[*int8]
func (m *MutableInt8p) DoHook(ctx context.Context) Field {
return zap.Int8p(m.Key, m.Fc(ctx))
}
type MutableUint MutableNamedField[uint]
func (m *MutableUint) DoHook(ctx context.Context) Field {
return zap.Uint(m.Key, m.Fc(ctx))
}
type MutableUintp MutableNamedField[*uint]
func (m *MutableUintp) DoHook(ctx context.Context) Field {
return zap.Uintp(m.Key, m.Fc(ctx))
}
type MutableUint64 MutableNamedField[uint64]
func (m *MutableUint64) DoHook(ctx context.Context) Field {
return zap.Uint64(m.Key, m.Fc(ctx))
}
type MutableUint64p MutableNamedField[*uint64]
func (m *MutableUint64p) DoHook(ctx context.Context) Field {
return zap.Uint64p(m.Key, m.Fc(ctx))
}
type MutableUint32 MutableNamedField[uint32]
func (m *MutableUint32) DoHook(ctx context.Context) Field {
return zap.Uint32(m.Key, m.Fc(ctx))
}
type MutableUint32p MutableNamedField[*uint32]
func (m *MutableUint32p) DoHook(ctx context.Context) Field {
return zap.Uint32p(m.Key, m.Fc(ctx))
}
type MutableUint16 MutableNamedField[uint16]
func (m *MutableUint16) DoHook(ctx context.Context) Field {
return zap.Uint16(m.Key, m.Fc(ctx))
}
type MutableUint16p MutableNamedField[*uint16]
func (m *MutableUint16p) DoHook(ctx context.Context) Field {
return zap.Uint16p(m.Key, m.Fc(ctx))
}
type MutableUint8 MutableNamedField[uint8]
func (m *MutableUint8) DoHook(ctx context.Context) Field {
return zap.Uint8(m.Key, m.Fc(ctx))
}
type MutableUint8p MutableNamedField[*uint8]
func (m *MutableUint8p) DoHook(ctx context.Context) Field {
return zap.Uint8p(m.Key, m.Fc(ctx))
}
type MutableString MutableNamedField[string]
func (m *MutableString) DoHook(ctx context.Context) Field {
return zap.String(m.Key, m.Fc(ctx))
}
type MutableStringp MutableNamedField[*string]
func (m *MutableStringp) DoHook(ctx context.Context) Field {
return zap.Stringp(m.Key, m.Fc(ctx))
}
type MutableUintptr MutableNamedField[uintptr]
func (m *MutableUintptr) DoHook(ctx context.Context) Field {
return zap.Uintptr(m.Key, m.Fc(ctx))
}
type MutableUintptrp MutableNamedField[*uintptr]
func (m *MutableUintptrp) DoHook(ctx context.Context) Field {
return zap.Uintptrp(m.Key, m.Fc(ctx))
}
type MutableReflect MutableNamedField[any]
func (m *MutableReflect) DoHook(ctx context.Context) Field {
return zap.Reflect(m.Key, m.Fc(ctx))
}
type MutableNamespace MutableFixedNamedField[string]
func (m *MutableNamespace) DoHook(ctx context.Context) Field {
return zap.Namespace(m.Fc(ctx))
}
type MutableStringer MutableNamedField[fmt.Stringer]
func (m *MutableStringer) DoHook(ctx context.Context) Field {
return zap.Stringer(m.Key, m.Fc(ctx))
}
type MutableTime MutableNamedField[time.Time]
func (m *MutableTime) DoHook(ctx context.Context) Field {
return zap.Time(m.Key, m.Fc(ctx))
}
type MutableTimep MutableNamedField[*time.Time]
func (m *MutableTimep) DoHook(ctx context.Context) Field {
return zap.Timep(m.Key, m.Fc(ctx))
}
type MutableDuration MutableNamedField[time.Duration]
func (m *MutableDuration) DoHook(ctx context.Context) Field {
return zap.Duration(m.Key, m.Fc(ctx))
}
type MutableDurationp MutableNamedField[*time.Duration]
func (m *MutableDurationp) DoHook(ctx context.Context) Field {
return zap.Durationp(m.Key, m.Fc(ctx))
}
type MutableObject MutableNamedField[ObjectMarshaler]
func (m *MutableObject) DoHook(ctx context.Context) Field {
return zap.Object(m.Key, m.Fc(ctx))
}
type MutableInline MutableFixedNamedField[ObjectMarshaler]
func (m *MutableInline) DoHook(ctx context.Context) Field {
return zap.Inline(m.Fc(ctx))
}
type MutableDict MutableNamedField[[]Field]
func (m *MutableDict) DoHook(ctx context.Context) Field {
return zap.Dict(m.Key, m.Fc(ctx)...)
}
type MutableAny MutableNamedField[any]
func (m *MutableAny) DoHook(ctx context.Context) Field {
return zap.Any(m.Key, m.Fc(ctx))
}