Skip to content

Commit

Permalink
Make GlobalLevel a public function (rs#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZloyDyadka authored and rs committed Apr 17, 2018
1 parent 70bea47 commit 1e2ce57
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion globals.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ func SetGlobalLevel(l Level) {
atomic.StoreUint32(gLevel, uint32(l))
}

func globalLevel() Level {
// GlobalLevel returns the current global log level
func GlobalLevel() Level {
return Level(atomic.LoadUint32(gLevel))
}

Expand Down
2 changes: 1 addition & 1 deletion log.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ func (l *Logger) newEvent(level Level, done func(string)) *Event {

// should returns true if the log event should be logged.
func (l *Logger) should(lvl Level) bool {
if lvl < l.level || lvl < globalLevel() {
if lvl < l.level || lvl < GlobalLevel() {
return false
}
if l.sampler != nil && !samplingDisabled() {
Expand Down

0 comments on commit 1e2ce57

Please sign in to comment.