diff --git a/middleware.go b/middleware.go index 153f6a1..03f9997 100644 --- a/middleware.go +++ b/middleware.go @@ -2,7 +2,6 @@ package sloggin import ( "bytes" - "context" "io" "net/http" "strings" @@ -194,7 +193,7 @@ func NewWithConfig(logger *slog.Logger, config Config) gin.HandlerFunc { msg = c.Errors.String() } - logger.LogAttrs(context.Background(), level, msg, attributes...) + logger.LogAttrs(c.Request.Context(), level, msg, attributes...) } }