protect slice bounds not out of range (#282)

pull/298/head
zhangji 5 years ago committed by Felix Hao
parent 5a6d1e01b0
commit 2c6eb487a3
  1. 6
      pkg/net/http/blademaster/logger.go

@ -34,8 +34,10 @@ func Logger() HandlerFunc {
caller = noUser
}
_metricServerReqCodeTotal.Inc(c.RoutePath[1:], caller, strconv.FormatInt(int64(cerr.Code()), 10))
_metricServerReqDur.Observe(int64(dt/time.Millisecond), c.RoutePath[1:], caller)
if len(c.RoutePath) > 0 {
_metricServerReqCodeTotal.Inc(c.RoutePath[1:], caller, strconv.FormatInt(int64(cerr.Code()), 10))
_metricServerReqDur.Observe(int64(dt/time.Millisecond), c.RoutePath[1:], caller)
}
lf := log.Infov
errmsg := ""

Loading…
Cancel
Save