Skip to content

Commit e4ce8c5

Browse files
authored
Merge pull request #57 from JinPengCN/patch-1
fix: Fix request latency output with default template.
2 parents 6fb592e + 18b7d3e commit e4ce8c5

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

accesslog/accesslog.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ func new(ctx context.Context, opts ...Option) app.HandlerFunc {
105105
}
106106

107107
return func(ctx context.Context, c *app.RequestContext) {
108-
var start, stop time.Time
109-
110108
// Logger data
111109
data := dataPool.Get().(*Data) //nolint:forcetypeassert,errcheck // We store nothing else in the pool
112110
// no need for a reset, as long as we always override everything
@@ -139,7 +137,7 @@ func new(ctx context.Context, opts ...Option) app.HandlerFunc {
139137
_, _ = buf.WriteString(fmt.Sprintf(defaultFormat,
140138
timestamp,
141139
c.Response.StatusCode(),
142-
stop.Sub(start),
140+
data.Stop.Sub(data.Start),
143141
c.Method(),
144142
c.Path(),
145143
))

0 commit comments

Comments
 (0)