Skip to content

Commit 6c3fea0

Browse files
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.
1 parent c1b69bd commit 6c3fea0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

log/handler.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ func StreamHandler(wr io.Writer, fmtr Format) Handler {
5252
func SyncHandler(h Handler) Handler {
5353
var mu sync.Mutex
5454
return FuncHandler(func(r *Record) error {
55-
defer mu.Unlock()
5655
mu.Lock()
56+
defer mu.Unlock()
57+
5758
return h.Log(r)
5859
})
5960
}

0 commit comments

Comments
 (0)