do not ignore skip func delay in latency calculation

This commit is contained in:
Ghobad Palvaneh 2023-05-14 18:25:50 +03:30
parent a97eec4055
commit 23da40cfaf

View File

@ -238,12 +238,6 @@ func LoggerWithConfig(conf LoggerConfig) HandlerFunc {
}
return func(c *Context) {
// Log only when it is not being skipped
if _, ok := skip[c.Request.URL.Path]; ok || (conf.Skip != nil && conf.Skip(c)) {
c.Next()
return
}
// Start timer
start := time.Now()
path := c.Request.URL.Path
@ -252,6 +246,11 @@ func LoggerWithConfig(conf LoggerConfig) HandlerFunc {
// Process request
c.Next()
// Log only when it is not being skipped
if _, ok := skip[path]; ok || (conf.Skip != nil && conf.Skip(c)) {
return
}
param := LogFormatterParams{
Request: c.Request,
isTerm: isTerm,