feat: new methods to check enabled log level

Adding 6 methods on 'exported', 'logger' and 'entry':
- IsDebugEnabled() bool
- IsInfoEnabled() bool
- IsWarnEnabled() bool
- IsErrorEnabled() bool
- IsFatalEnabled() bool
- IsPanicEnabled() bool

Replace duplicated 'if logger.level() >= XxxxLevel' by a call to the new methods in 'logger' and 'entry'

Closes #761
This commit is contained in:
Logan HAUSPIE
2018-05-30 01:47:39 +02:00
parent ea8897e799
commit 4225d694ba
5 changed files with 169 additions and 39 deletions
+7
View File
@@ -140,4 +140,11 @@ type FieldLogger interface {
Errorln(args ...interface{})
Fatalln(args ...interface{})
Panicln(args ...interface{})
IsDebugEnabled() bool
IsInfoEnabled() bool
IsWarnEnabled() bool
IsErrorEnabled() bool
IsFatalEnabled() bool
IsPanicEnabled() bool
}