Skip to content

Commit

Permalink
fix: Fix the bug where the request latency is not correctly output wh…
Browse files Browse the repository at this point in the history
…en using the default template.

Associated issue: #56
  • Loading branch information
JinPengCN authored Nov 7, 2024
1 parent 6fb592e commit 18b7d3e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions accesslog/accesslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ func new(ctx context.Context, opts ...Option) app.HandlerFunc {
}

return func(ctx context.Context, c *app.RequestContext) {
var start, stop time.Time

// Logger data
data := dataPool.Get().(*Data) //nolint:forcetypeassert,errcheck // We store nothing else in the pool
// no need for a reset, as long as we always override everything
Expand Down Expand Up @@ -139,7 +137,7 @@ func new(ctx context.Context, opts ...Option) app.HandlerFunc {
_, _ = buf.WriteString(fmt.Sprintf(defaultFormat,
timestamp,
c.Response.StatusCode(),
stop.Sub(start),
data.Stop.Sub(data.Start),
c.Method(),
c.Path(),
))
Expand Down

0 comments on commit 18b7d3e

Please sign in to comment.