atmost working example

This commit is contained in:
Aleksandr Trushkin
2024-08-11 21:44:19 +03:00
parent 0046755c7d
commit 880f67aa73
16 changed files with 566 additions and 107 deletions

View File

@ -44,7 +44,7 @@ func middlewareLogger(log *slog.Logger) middlewareFunc {
path := r.URL.Path
query := r.URL.Query().Encode()
log.InfoContext(
log.DebugContext(
r.Context(), "request processing",
slog.String("request_id", requestID),
slog.String("method", method),
@ -54,10 +54,9 @@ func middlewareLogger(log *slog.Logger) middlewareFunc {
next.ServeHTTP(w, r)
elapsed := time.Since(start)
log.InfoContext(
r.Context(), "request finished",
slog.Duration("elapsed", elapsed.Truncate(time.Millisecond)),
slog.Int64("elapsed", time.Since(start).Milliseconds()),
)
})
}