Skip to content

Commit

Permalink
fix: remove duplicate time log field
Browse files Browse the repository at this point in the history
  • Loading branch information
Houtmann committed Oct 6, 2023
1 parent 69ec446 commit 0d9cea0
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions middleware/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import (

"github.com/gin-gonic/gin"
"github.com/google/uuid"
"github.com/thoas/picfit/config"
"github.com/thoas/picfit/constants"
loggerpkg "github.com/thoas/picfit/logger"
)

func NewLogger(cfg *config.Config, logger *slog.Logger) gin.HandlerFunc {
func NewLogger(logger *slog.Logger) gin.HandlerFunc {
return func(c *gin.Context) {
var (
ctx = c.Request.Context()
Expand All @@ -27,7 +26,6 @@ func NewLogger(cfg *config.Config, logger *slog.Logger) gin.HandlerFunc {

c.Next()

end := time.Now()
attributes := []slog.Attr{
slog.Int("status", c.Writer.Status()),
slog.String("method", c.Request.Method),
Expand All @@ -36,7 +34,6 @@ func NewLogger(cfg *config.Config, logger *slog.Logger) gin.HandlerFunc {
slog.String("ip", c.ClientIP()),
slog.Duration("duration", time.Since(start)),
slog.String("user-agent", c.Request.UserAgent()),
slog.Time("time", end.UTC()),
}

if len(c.Errors) > 0 {
Expand Down

0 comments on commit 0d9cea0

Please sign in to comment.