From 23da40cfaf9304bb2f32889628717d85e2da666e Mon Sep 17 00:00:00 2001 From: Ghobad Palvaneh Date: Sun, 14 May 2023 18:25:50 +0330 Subject: [PATCH] do not ignore skip func delay in latency calculation --- logger.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/logger.go b/logger.go index 3dc16215..47e262d0 100644 --- a/logger.go +++ b/logger.go @@ -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,