avoid holding the req log lock for so long

This commit is contained in:
Azareal 2021-03-24 13:25:37 +10:00
parent f073f29a09
commit 1d747a6f68
1 changed files with 2 additions and 1 deletions

View File

@ -205,8 +205,9 @@ func (r *GenRouter) ddumpRequest(req *http.Request, pre string, l *RouterLog, sb
nfield("\nIP: ", req.RemoteAddr)
sb.WriteString("\n")
str := sb.String()
l.RLock()
l.LogVal.Load().(*log.Logger).Print(sb.String())
l.LogVal.Load().(*log.Logger).Print(str)
l.RUnlock()
}