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 make it possible for client code to accept either Logger or Entry.
For example, utility function may accept logger object to inform fatal
errors and it is job of the calling code to provide either generic
top-level logger, or request-bound Entry created using .WithFields.
(fixes#308)
`std.Level` is protected by mutex in setter (SetLevel),
so it must be protected in geetter (GetLevel) too.
Signed-off-by: Anton Tiurin <noxiouz@yandex.ru>
The Level() family of log methods defer formatting of log
values until it is confident that the log level needs them.
This change allows that deferral to happen at the Levelf()
and Levelln() levels too.
This commit also adds benchmarks to demonstrate the improved
performance of these functions