@@ -251,162 +251,136 @@ func (entry *Entry) write() {
251
251
}
252
252
}
253
253
254
- func (entry * Entry ) Trace ( args ... interface {}) {
255
- if entry .Logger .IsLevelEnabled (TraceLevel ) {
256
- entry .log (TraceLevel , fmt .Sprint (args ... ))
254
+ func (entry * Entry ) Log ( level Level , args ... interface {}) {
255
+ if entry .Logger .IsLevelEnabled (level ) {
256
+ entry .log (level , fmt .Sprint (args ... ))
257
257
}
258
258
}
259
259
260
+ func (entry * Entry ) Trace (args ... interface {}) {
261
+ entry .Log (TraceLevel , args ... )
262
+ }
263
+
260
264
func (entry * Entry ) Debug (args ... interface {}) {
261
- if entry .Logger .IsLevelEnabled (DebugLevel ) {
262
- entry .log (DebugLevel , fmt .Sprint (args ... ))
263
- }
265
+ entry .Log (DebugLevel , args ... )
264
266
}
265
267
266
268
func (entry * Entry ) Print (args ... interface {}) {
267
269
entry .Info (args ... )
268
270
}
269
271
270
272
func (entry * Entry ) Info (args ... interface {}) {
271
- if entry .Logger .IsLevelEnabled (InfoLevel ) {
272
- entry .log (InfoLevel , fmt .Sprint (args ... ))
273
- }
273
+ entry .Log (InfoLevel , args ... )
274
274
}
275
275
276
276
func (entry * Entry ) Warn (args ... interface {}) {
277
- if entry .Logger .IsLevelEnabled (WarnLevel ) {
278
- entry .log (WarnLevel , fmt .Sprint (args ... ))
279
- }
277
+ entry .Log (WarnLevel , args ... )
280
278
}
281
279
282
280
func (entry * Entry ) Warning (args ... interface {}) {
283
281
entry .Warn (args ... )
284
282
}
285
283
286
284
func (entry * Entry ) Error (args ... interface {}) {
287
- if entry .Logger .IsLevelEnabled (ErrorLevel ) {
288
- entry .log (ErrorLevel , fmt .Sprint (args ... ))
289
- }
285
+ entry .Log (ErrorLevel , args ... )
290
286
}
291
287
292
288
func (entry * Entry ) Fatal (args ... interface {}) {
293
- if entry .Logger .IsLevelEnabled (FatalLevel ) {
294
- entry .log (FatalLevel , fmt .Sprint (args ... ))
295
- }
289
+ entry .Log (FatalLevel , args ... )
296
290
entry .Logger .Exit (1 )
297
291
}
298
292
299
293
func (entry * Entry ) Panic (args ... interface {}) {
300
- if entry .Logger .IsLevelEnabled (PanicLevel ) {
301
- entry .log (PanicLevel , fmt .Sprint (args ... ))
302
- }
294
+ entry .Log (PanicLevel , args ... )
303
295
panic (fmt .Sprint (args ... ))
304
296
}
305
297
306
298
// Entry Printf family functions
307
299
300
+ func (entry * Entry ) Logf (level Level , format string , args ... interface {}) {
301
+ entry .Log (level , fmt .Sprintf (format , args ... ))
302
+ }
303
+
308
304
func (entry * Entry ) Tracef (format string , args ... interface {}) {
309
- if entry .Logger .IsLevelEnabled (TraceLevel ) {
310
- entry .Trace (fmt .Sprintf (format , args ... ))
311
- }
305
+ entry .Logf (TraceLevel , format , args ... )
312
306
}
313
307
314
308
func (entry * Entry ) Debugf (format string , args ... interface {}) {
315
- if entry .Logger .IsLevelEnabled (DebugLevel ) {
316
- entry .Debug (fmt .Sprintf (format , args ... ))
317
- }
309
+ entry .Logf (DebugLevel , format , args ... )
318
310
}
319
311
320
312
func (entry * Entry ) Infof (format string , args ... interface {}) {
321
- if entry .Logger .IsLevelEnabled (InfoLevel ) {
322
- entry .Info (fmt .Sprintf (format , args ... ))
323
- }
313
+ entry .Logf (InfoLevel , format , args ... )
324
314
}
325
315
326
316
func (entry * Entry ) Printf (format string , args ... interface {}) {
327
317
entry .Infof (format , args ... )
328
318
}
329
319
330
320
func (entry * Entry ) Warnf (format string , args ... interface {}) {
331
- if entry .Logger .IsLevelEnabled (WarnLevel ) {
332
- entry .Warn (fmt .Sprintf (format , args ... ))
333
- }
321
+ entry .Logf (WarnLevel , format , args ... )
334
322
}
335
323
336
324
func (entry * Entry ) Warningf (format string , args ... interface {}) {
337
325
entry .Warnf (format , args ... )
338
326
}
339
327
340
328
func (entry * Entry ) Errorf (format string , args ... interface {}) {
341
- if entry .Logger .IsLevelEnabled (ErrorLevel ) {
342
- entry .Error (fmt .Sprintf (format , args ... ))
343
- }
329
+ entry .Logf (ErrorLevel , format , args ... )
344
330
}
345
331
346
332
func (entry * Entry ) Fatalf (format string , args ... interface {}) {
347
- if entry .Logger .IsLevelEnabled (FatalLevel ) {
348
- entry .Fatal (fmt .Sprintf (format , args ... ))
349
- }
333
+ entry .Logf (FatalLevel , format , args ... )
350
334
entry .Logger .Exit (1 )
351
335
}
352
336
353
337
func (entry * Entry ) Panicf (format string , args ... interface {}) {
354
- if entry .Logger .IsLevelEnabled (PanicLevel ) {
355
- entry .Panic (fmt .Sprintf (format , args ... ))
356
- }
338
+ entry .Logf (PanicLevel , format , args ... )
357
339
}
358
340
359
341
// Entry Println family functions
360
342
361
- func (entry * Entry ) Traceln ( args ... interface {}) {
362
- if entry .Logger .IsLevelEnabled (TraceLevel ) {
363
- entry .Trace ( entry .sprintlnn (args ... ))
343
+ func (entry * Entry ) Logln ( level Level , args ... interface {}) {
344
+ if entry .Logger .IsLevelEnabled (level ) {
345
+ entry .Log ( level , entry .sprintlnn (args ... ))
364
346
}
365
347
}
366
348
349
+ func (entry * Entry ) Traceln (args ... interface {}) {
350
+ entry .Logln (TraceLevel , args ... )
351
+ }
352
+
367
353
func (entry * Entry ) Debugln (args ... interface {}) {
368
- if entry .Logger .IsLevelEnabled (DebugLevel ) {
369
- entry .Debug (entry .sprintlnn (args ... ))
370
- }
354
+ entry .Logln (DebugLevel , args ... )
371
355
}
372
356
373
357
func (entry * Entry ) Infoln (args ... interface {}) {
374
- if entry .Logger .IsLevelEnabled (InfoLevel ) {
375
- entry .Info (entry .sprintlnn (args ... ))
376
- }
358
+ entry .Logln (InfoLevel , args ... )
377
359
}
378
360
379
361
func (entry * Entry ) Println (args ... interface {}) {
380
362
entry .Infoln (args ... )
381
363
}
382
364
383
365
func (entry * Entry ) Warnln (args ... interface {}) {
384
- if entry .Logger .IsLevelEnabled (WarnLevel ) {
385
- entry .Warn (entry .sprintlnn (args ... ))
386
- }
366
+ entry .Logln (WarnLevel , args ... )
387
367
}
388
368
389
369
func (entry * Entry ) Warningln (args ... interface {}) {
390
370
entry .Warnln (args ... )
391
371
}
392
372
393
373
func (entry * Entry ) Errorln (args ... interface {}) {
394
- if entry .Logger .IsLevelEnabled (ErrorLevel ) {
395
- entry .Error (entry .sprintlnn (args ... ))
396
- }
374
+ entry .Logln (ErrorLevel , args ... )
397
375
}
398
376
399
377
func (entry * Entry ) Fatalln (args ... interface {}) {
400
- if entry .Logger .IsLevelEnabled (FatalLevel ) {
401
- entry .Fatal (entry .sprintlnn (args ... ))
402
- }
378
+ entry .Logln (FatalLevel , args ... )
403
379
entry .Logger .Exit (1 )
404
380
}
405
381
406
382
func (entry * Entry ) Panicln (args ... interface {}) {
407
- if entry .Logger .IsLevelEnabled (PanicLevel ) {
408
- entry .Panic (entry .sprintlnn (args ... ))
409
- }
383
+ entry .Logln (PanicLevel , args ... )
410
384
}
411
385
412
386
// Sprintlnn => Sprint no newline. This is to get the behavior of how
0 commit comments