Skip to content

Commit

Permalink
middleware/logger: use time.Since instead of Sub
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Dao <[email protected]>
  • Loading branch information
dqminh authored and Peter Kieltyka committed Jun 15, 2017
1 parent 9435d85 commit d96632e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions middleware/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ func RequestLogger(f LogFormatter) func(next http.Handler) http.Handler {

t1 := time.Now()
defer func() {
t2 := time.Now()
entry.Write(ww.Status(), ww.BytesWritten(), t2.Sub(t1))
entry.Write(ww.Status(), ww.BytesWritten(), time.Since(t1))
}()

next.ServeHTTP(ww, WithLogEntry(r, entry))
Expand Down

0 comments on commit d96632e

Please sign in to comment.