Make GlobalLevel a public function (#53)
This commit is contained in:
parent
70bea47cc0
commit
1e2ce57d98
|
@ -49,7 +49,8 @@ func SetGlobalLevel(l Level) {
|
||||||
atomic.StoreUint32(gLevel, uint32(l))
|
atomic.StoreUint32(gLevel, uint32(l))
|
||||||
}
|
}
|
||||||
|
|
||||||
func globalLevel() Level {
|
// GlobalLevel returns the current global log level
|
||||||
|
func GlobalLevel() Level {
|
||||||
return Level(atomic.LoadUint32(gLevel))
|
return Level(atomic.LoadUint32(gLevel))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
log.go
2
log.go
|
@ -366,7 +366,7 @@ func (l *Logger) newEvent(level Level, done func(string)) *Event {
|
||||||
|
|
||||||
// should returns true if the log event should be logged.
|
// should returns true if the log event should be logged.
|
||||||
func (l *Logger) should(lvl Level) bool {
|
func (l *Logger) should(lvl Level) bool {
|
||||||
if lvl < l.level || lvl < globalLevel() {
|
if lvl < l.level || lvl < GlobalLevel() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if l.sampler != nil && !samplingDisabled() {
|
if l.sampler != nil && !samplingDisabled() {
|
||||||
|
|
Loading…
Reference in New Issue