log: modify lock defer unlock order in sync handler (#24667)

This modifies the order of Lock() defer Unlock() to follow the more
typically used pattern.
pull/24674/head
aaronbuchwald 3 years ago committed by GitHub
parent c1b69bd121
commit 6c3fea0fc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      log/handler.go

@ -52,8 +52,9 @@ func StreamHandler(wr io.Writer, fmtr Format) Handler {
func SyncHandler(h Handler) Handler {
var mu sync.Mutex
return FuncHandler(func(r *Record) error {
defer mu.Unlock()
mu.Lock()
defer mu.Unlock()
return h.Log(r)
})
}

Loading…
Cancel
Save