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