call done function when logger is disabled (#393)

This commit is contained in:
Arnau 2022-01-04 17:12:02 +01:00 committed by GitHub
parent c0c2e11fc3
commit 3efdd82416
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

3
log.go
View File

@ -428,6 +428,9 @@ func (l Logger) Write(p []byte) (n int, err error) {
func (l *Logger) newEvent(level Level, done func(string)) *Event { func (l *Logger) newEvent(level Level, done func(string)) *Event {
enabled := l.should(level) enabled := l.should(level)
if !enabled { if !enabled {
if done != nil {
done("")
}
return nil return nil
} }
e := newEvent(l.w, level) e := newEvent(l.w, level)