@@ -80,7 +80,7 @@ func (l Level) String() string {
80
80
type Emitter interface {
81
81
// Emit emits the given log statement. This allows for control over the
82
82
// timestamp used for logging.
83
- Emit (depth int , level Level , timestamp time.Time , format string , v ... interface {} )
83
+ Emit (depth int , level Level , timestamp time.Time , format string , v ... any )
84
84
}
85
85
86
86
// Writer writes the output to the given writer.
@@ -144,23 +144,23 @@ func (l *Writer) Write(data []byte) (int, error) {
144
144
}
145
145
146
146
// Emit emits the message.
147
- func (l * Writer ) Emit (_ int , _ Level , _ time.Time , format string , args ... interface {} ) {
147
+ func (l * Writer ) Emit (_ int , _ Level , _ time.Time , format string , args ... any ) {
148
148
fmt .Fprintf (l , format , args ... )
149
149
}
150
150
151
151
// MultiEmitter is an emitter that emits to multiple Emitters.
152
152
type MultiEmitter []Emitter
153
153
154
154
// Emit emits to all emitters.
155
- func (m * MultiEmitter ) Emit (depth int , level Level , timestamp time.Time , format string , v ... interface {} ) {
155
+ func (m * MultiEmitter ) Emit (depth int , level Level , timestamp time.Time , format string , v ... any ) {
156
156
for _ , e := range * m {
157
157
e .Emit (1 + depth , level , timestamp , format , v ... )
158
158
}
159
159
}
160
160
161
161
// TestLogger is implemented by testing.T and testing.B.
162
162
type TestLogger interface {
163
- Logf (format string , v ... interface {} )
163
+ Logf (format string , v ... any )
164
164
}
165
165
166
166
// TestEmitter may be used for wrapping tests.
@@ -169,7 +169,7 @@ type TestEmitter struct {
169
169
}
170
170
171
171
// Emit emits to the TestLogger.
172
- func (t * TestEmitter ) Emit (_ int , level Level , timestamp time.Time , format string , v ... interface {} ) {
172
+ func (t * TestEmitter ) Emit (_ int , level Level , timestamp time.Time , format string , v ... any ) {
173
173
t .Logf (format , v ... )
174
174
}
175
175
@@ -179,13 +179,13 @@ func (t *TestEmitter) Emit(_ int, level Level, timestamp time.Time, format strin
179
179
// satisfies this interface, and may be passed around as a Logger.
180
180
type Logger interface {
181
181
// Debugf logs a debug statement.
182
- Debugf (format string , v ... interface {} )
182
+ Debugf (format string , v ... any )
183
183
184
184
// Infof logs at an info level.
185
- Infof (format string , v ... interface {} )
185
+ Infof (format string , v ... any )
186
186
187
187
// Warningf logs at a warning level.
188
- Warningf (format string , v ... interface {} )
188
+ Warningf (format string , v ... any )
189
189
190
190
// IsLogging returns true iff this level is being logged. This may be
191
191
// used to short-circuit expensive operations for debugging calls.
@@ -199,36 +199,36 @@ type BasicLogger struct {
199
199
}
200
200
201
201
// Debugf implements logger.Debugf.
202
- func (l * BasicLogger ) Debugf (format string , v ... interface {} ) {
202
+ func (l * BasicLogger ) Debugf (format string , v ... any ) {
203
203
l .DebugfAtDepth (1 , format , v ... )
204
204
}
205
205
206
206
// Infof implements logger.Infof.
207
- func (l * BasicLogger ) Infof (format string , v ... interface {} ) {
207
+ func (l * BasicLogger ) Infof (format string , v ... any ) {
208
208
l .InfofAtDepth (1 , format , v ... )
209
209
}
210
210
211
211
// Warningf implements logger.Warningf.
212
- func (l * BasicLogger ) Warningf (format string , v ... interface {} ) {
212
+ func (l * BasicLogger ) Warningf (format string , v ... any ) {
213
213
l .WarningfAtDepth (1 , format , v ... )
214
214
}
215
215
216
216
// DebugfAtDepth logs at a specific depth.
217
- func (l * BasicLogger ) DebugfAtDepth (depth int , format string , v ... interface {} ) {
217
+ func (l * BasicLogger ) DebugfAtDepth (depth int , format string , v ... any ) {
218
218
if l .IsLogging (Debug ) {
219
219
l .Emit (1 + depth , Debug , time .Now (), format , v ... )
220
220
}
221
221
}
222
222
223
223
// InfofAtDepth logs at a specific depth.
224
- func (l * BasicLogger ) InfofAtDepth (depth int , format string , v ... interface {} ) {
224
+ func (l * BasicLogger ) InfofAtDepth (depth int , format string , v ... any ) {
225
225
if l .IsLogging (Info ) {
226
226
l .Emit (1 + depth , Info , time .Now (), format , v ... )
227
227
}
228
228
}
229
229
230
230
// WarningfAtDepth logs at a specific depth.
231
- func (l * BasicLogger ) WarningfAtDepth (depth int , format string , v ... interface {} ) {
231
+ func (l * BasicLogger ) WarningfAtDepth (depth int , format string , v ... any ) {
232
232
if l .IsLogging (Warning ) {
233
233
l .Emit (1 + depth , Warning , time .Now (), format , v ... )
234
234
}
@@ -275,32 +275,32 @@ func SetLevel(newLevel Level) {
275
275
}
276
276
277
277
// Debugf logs to the global logger.
278
- func Debugf (format string , v ... interface {} ) {
278
+ func Debugf (format string , v ... any ) {
279
279
Log ().DebugfAtDepth (1 , format , v ... )
280
280
}
281
281
282
282
// Infof logs to the global logger.
283
- func Infof (format string , v ... interface {} ) {
283
+ func Infof (format string , v ... any ) {
284
284
Log ().InfofAtDepth (1 , format , v ... )
285
285
}
286
286
287
287
// Warningf logs to the global logger.
288
- func Warningf (format string , v ... interface {} ) {
288
+ func Warningf (format string , v ... any ) {
289
289
Log ().WarningfAtDepth (1 , format , v ... )
290
290
}
291
291
292
292
// DebugfAtDepth logs to the global logger.
293
- func DebugfAtDepth (depth int , format string , v ... interface {} ) {
293
+ func DebugfAtDepth (depth int , format string , v ... any ) {
294
294
Log ().DebugfAtDepth (1 + depth , format , v ... )
295
295
}
296
296
297
297
// InfofAtDepth logs to the global logger.
298
- func InfofAtDepth (depth int , format string , v ... interface {} ) {
298
+ func InfofAtDepth (depth int , format string , v ... any ) {
299
299
Log ().InfofAtDepth (1 + depth , format , v ... )
300
300
}
301
301
302
302
// WarningfAtDepth logs to the global logger.
303
- func WarningfAtDepth (depth int , format string , v ... interface {} ) {
303
+ func WarningfAtDepth (depth int , format string , v ... any ) {
304
304
Log ().WarningfAtDepth (1 + depth , format , v ... )
305
305
}
306
306
@@ -329,15 +329,15 @@ func Stacks(all bool) []byte {
329
329
// goroutine.
330
330
//
331
331
// This will be print a traceback, tb, as Warningf(format+":\n%s", v..., tb).
332
- func Traceback (format string , v ... interface {} ) {
332
+ func Traceback (format string , v ... any ) {
333
333
v = append (v , Stacks (false ))
334
334
Warningf (format + ":\n %s" , v ... )
335
335
}
336
336
337
337
// TracebackAll logs the given message and dumps a stacktrace of all goroutines.
338
338
//
339
339
// This will be print a traceback, tb, as Warningf(format+":\n%s", v..., tb).
340
- func TracebackAll (format string , v ... interface {} ) {
340
+ func TracebackAll (format string , v ... any ) {
341
341
v = append (v , Stacks (true ))
342
342
Warningf (format + ":\n %s" , v ... )
343
343
}
@@ -350,7 +350,7 @@ func IsLogging(level Level) bool {
350
350
// CopyStandardLogTo redirects the stdlib log package global output to the global
351
351
// logger for the specified level.
352
352
func CopyStandardLogTo (l Level ) error {
353
- var f func (string , ... interface {} )
353
+ var f func (string , ... any )
354
354
355
355
switch l {
356
356
case Debug :
0 commit comments