@@ -57,7 +57,7 @@ func (l *Logger) NewInstance() *logrus.Logger {
57
57
if strings .EqualFold (LoggerTextFormatter , l .Formatter ) {
58
58
logger .SetFormatter (l .TextFormatter ())
59
59
}
60
- if l .AllowSnapshot {
60
+ if l .PermitSnapshot {
61
61
logger .SetFormatter (l .JsonFormatter ())
62
62
}
63
63
logger .AddHook (l .TextHook ())
@@ -117,13 +117,13 @@ func (l *Logger) TextFormatter() *logrus.TextFormatter {
117
117
func (l * Logger ) Config () * lumberjack.Logger {
118
118
LoggerValidator (l )
119
119
j := & lumberjack.Logger {}
120
- if l .AllowSnapshot {
120
+ if l .PermitSnapshot {
121
121
j .Filename = l .Filename
122
122
j .MaxSize = l .MaxSize
123
- j .MaxBackups = l .MaxBackups
123
+ j .MaxBackups = l .MaxBackup
124
124
j .MaxAge = l .MaxAge
125
125
j .Compress = l .Compress
126
- j .LocalTime = l .AllowLocalTime
126
+ j .LocalTime = l .PermitLocalTime
127
127
}
128
128
return j
129
129
}
@@ -140,7 +140,7 @@ func (l *Logger) ApplyConfig() *Logger {
140
140
if strings .EqualFold (LoggerTextFormatter , l .Formatter ) {
141
141
l .instance .SetFormatter (l .TextFormatter ())
142
142
}
143
- if l .AllowSnapshot {
143
+ if l .PermitSnapshot {
144
144
l .instance .SetFormatter (l .JsonFormatter ())
145
145
}
146
146
l .ResetLogger ()
@@ -162,12 +162,12 @@ func (l *Logger) SetEnabled(value bool) *Logger {
162
162
}
163
163
164
164
func (l * Logger ) SetAllowSnapshot (value bool ) * Logger {
165
- l .AllowSnapshot = value
165
+ l .PermitSnapshot = value
166
166
return l
167
167
}
168
168
169
169
func (l * Logger ) SetAllowLocalTime (value bool ) * Logger {
170
- l .AllowLocalTime = value
170
+ l .PermitLocalTime = value
171
171
return l
172
172
}
173
173
@@ -177,7 +177,7 @@ func (l *Logger) SetCompress(value bool) *Logger {
177
177
}
178
178
179
179
func (l * Logger ) SetFilename (value string ) * Logger {
180
- if l .AllowSnapshot {
180
+ if l .PermitSnapshot {
181
181
if utils .IsEmpty (value ) {
182
182
log .Panic ("Filename is required" )
183
183
}
@@ -189,7 +189,7 @@ func (l *Logger) SetFilename(value string) *Logger {
189
189
}
190
190
191
191
func (l * Logger ) SetMaxSize (value int ) * Logger {
192
- if l .AllowSnapshot {
192
+ if l .PermitSnapshot {
193
193
if value < 0 {
194
194
log .Panic ("Invalid max-size" )
195
195
}
@@ -199,7 +199,7 @@ func (l *Logger) SetMaxSize(value int) *Logger {
199
199
}
200
200
201
201
func (l * Logger ) SetMaxAge (value int ) * Logger {
202
- if l .AllowSnapshot {
202
+ if l .PermitSnapshot {
203
203
if value <= 0 {
204
204
log .Panic ("Invalid max-age" )
205
205
}
@@ -209,12 +209,12 @@ func (l *Logger) SetMaxAge(value int) *Logger {
209
209
}
210
210
211
211
func (l * Logger ) SetMaxBackups (value int ) * Logger {
212
- if l .AllowSnapshot {
212
+ if l .PermitSnapshot {
213
213
if value <= 0 {
214
214
log .Panic ("Invalid max-backups" )
215
215
}
216
216
}
217
- l .MaxBackups = value
217
+ l .MaxBackup = value
218
218
return l
219
219
}
220
220
@@ -226,7 +226,7 @@ func (l *Logger) SetFormatter(value string) *Logger {
226
226
}
227
227
228
228
func (l * Logger ) SetAllowCaller (value bool ) * Logger {
229
- l .AllowCaller = value
229
+ l .PermitCaller = value
230
230
return l
231
231
}
232
232
@@ -241,7 +241,7 @@ func LoggerValidator(l *Logger) {
241
241
l .
242
242
SetMaxSize (l .MaxSize ).
243
243
SetMaxAge (l .MaxAge ).
244
- SetMaxBackups (l .MaxBackups ).
244
+ SetMaxBackups (l .MaxBackup ).
245
245
SetFilename (l .Filename )
246
246
}
247
247
@@ -294,7 +294,7 @@ func (l *Logger) Info(message string, params ...interface{}) {
294
294
if strings .Contains (message , "%" ) {
295
295
fields = make (logrus.Fields , (len (params )/ 2 )+ 1 )
296
296
fields [LoggerMessageField ] = fmt .Sprintf (message , params ... )
297
- if l .AllowCaller {
297
+ if l .PermitCaller {
298
298
fields [LoggerCallerField ] = fmt .Sprintf ("%s:%d" , filename , line )
299
299
}
300
300
for i := 0 ; i < len (params ); i += 2 {
@@ -310,7 +310,7 @@ func (l *Logger) Info(message string, params ...interface{}) {
310
310
} else {
311
311
fields = make (logrus.Fields , 1 )
312
312
fields [LoggerMessageField ] = message
313
- if l .AllowCaller {
313
+ if l .PermitCaller {
314
314
fields [LoggerCallerField ] = fmt .Sprintf ("%s:%d" , filename , line )
315
315
}
316
316
for i := 0 ; i < len (params ); i += 2 {
@@ -347,7 +347,7 @@ func (l *Logger) Error(message string, err error, params ...interface{}) {
347
347
if strings .Contains (message , "%" ) {
348
348
fields = make (logrus.Fields , (len (params )/ 2 )+ 2 )
349
349
fields [LoggerMessageField ] = fmt .Sprintf (message , params ... )
350
- if l .AllowCaller {
350
+ if l .PermitCaller {
351
351
fields [LoggerCallerField ] = fmt .Sprintf ("%s:%d" , filename , line )
352
352
}
353
353
if err != nil {
@@ -366,7 +366,7 @@ func (l *Logger) Error(message string, err error, params ...interface{}) {
366
366
} else {
367
367
fields = make (logrus.Fields , 2 )
368
368
fields [LoggerMessageField ] = message
369
- if l .AllowCaller {
369
+ if l .PermitCaller {
370
370
fields [LoggerCallerField ] = fmt .Sprintf ("%s:%d" , filename , line )
371
371
}
372
372
if err != nil {
@@ -406,7 +406,7 @@ func (l *Logger) Warn(message string, params ...interface{}) {
406
406
if strings .Contains (message , "%" ) {
407
407
fields = make (logrus.Fields , (len (params )/ 2 )+ 1 )
408
408
fields [LoggerMessageField ] = fmt .Sprintf (message , params ... )
409
- if l .AllowCaller {
409
+ if l .PermitCaller {
410
410
fields [LoggerCallerField ] = fmt .Sprintf ("%s:%d" , filename , line )
411
411
}
412
412
for i := 0 ; i < len (params ); i += 2 {
@@ -422,7 +422,7 @@ func (l *Logger) Warn(message string, params ...interface{}) {
422
422
} else {
423
423
fields = make (logrus.Fields , 1 )
424
424
fields [LoggerMessageField ] = message
425
- if l .AllowCaller {
425
+ if l .PermitCaller {
426
426
fields [LoggerCallerField ] = fmt .Sprintf ("%s:%d" , filename , line )
427
427
}
428
428
for i := 0 ; i < len (params ); i += 2 {
@@ -459,7 +459,7 @@ func (l *Logger) Debug(message string, params ...interface{}) {
459
459
if strings .Contains (message , "%" ) {
460
460
fields = make (logrus.Fields , (len (params )/ 2 )+ 1 )
461
461
fields [LoggerMessageField ] = fmt .Sprintf (message , params ... )
462
- if l .AllowCaller {
462
+ if l .PermitCaller {
463
463
fields [LoggerCallerField ] = fmt .Sprintf ("%s:%d" , filename , line )
464
464
}
465
465
for i := 0 ; i < len (params ); i += 2 {
@@ -475,7 +475,7 @@ func (l *Logger) Debug(message string, params ...interface{}) {
475
475
} else {
476
476
fields = make (logrus.Fields , 1 )
477
477
fields [LoggerMessageField ] = message
478
- if l .AllowCaller {
478
+ if l .PermitCaller {
479
479
fields [LoggerCallerField ] = fmt .Sprintf ("%s:%d" , filename , line )
480
480
}
481
481
for i := 0 ; i < len (params ); i += 2 {
@@ -513,7 +513,7 @@ func (l *Logger) Success(message string, params ...interface{}) {
513
513
fields = make (logrus.Fields , (len (params )/ 2 )+ 2 )
514
514
fields [LoggerMessageField ] = fmt .Sprintf (message , params ... )
515
515
fields [LoggerSuccessField ] = true
516
- if l .AllowCaller {
516
+ if l .PermitCaller {
517
517
fields [LoggerCallerField ] = fmt .Sprintf ("%s:%d" , filename , line )
518
518
}
519
519
for i := 0 ; i < len (params ); i += 2 {
@@ -530,7 +530,7 @@ func (l *Logger) Success(message string, params ...interface{}) {
530
530
fields = make (logrus.Fields , 2 )
531
531
fields [LoggerMessageField ] = message
532
532
fields [LoggerSuccessField ] = true
533
- if l .AllowCaller {
533
+ if l .PermitCaller {
534
534
fields [LoggerCallerField ] = fmt .Sprintf ("%s:%d" , filename , line )
535
535
}
536
536
for i := 0 ; i < len (params ); i += 2 {
0 commit comments