Skip to content

Commit

Permalink
slog http logger: durationUs (microseconds)
Browse files Browse the repository at this point in the history
  • Loading branch information
metachris committed Jun 11, 2024
1 parent 4461ab7 commit 0ba72f2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (
github.com/stretchr/testify v1.8.4
go.uber.org/atomic v1.11.0
go.uber.org/zap v1.25.0
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
)

require (
Expand All @@ -34,7 +35,6 @@ require (
github.com/tklauser/numcpus v0.6.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.16.0 // indirect
Expand Down
2 changes: 1 addition & 1 deletion httplogger/httplogger.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func LoggingMiddlewareSlog(logger *slog.Logger, next http.Handler) http.Handler
"status", wrapped.status,
"method", r.Method,
"path", r.URL.EscapedPath(),
"duration", fmt.Sprintf("%f", time.Since(start).Seconds()),
"durationUs", fmt.Sprint(time.Since(start).Microseconds()),
)
},
)
Expand Down

0 comments on commit 0ba72f2

Please sign in to comment.