Skip to content

Commit

Permalink
log: log unexpected error and ignore healthcheck (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
j2gg0s authored Oct 14, 2024
1 parent c644fff commit 7019f5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions failure/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func Handle(h Handler) gin.HandlerFunc {
c.String(http.StatusBadRequest, cerr.Error())
}

c.Error(err)
panic(err)
}
}
Expand Down
7 changes: 4 additions & 3 deletions server/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,16 @@ func (s *HTTPServer) Init() error {
}
)

router.GET("/healthcheck", handlers.healthcheck(time.Now().UTC()))

router.Use(middleware.NewLogger(s.processor.Logger))

if s.config.Debug {
router.Use(gin.Recovery())
} else {
router.Use(middleware.Recover)
}

router.Use(middleware.NewLogger(s.processor.Logger))
router.Use(middleware.Metrics)

if s.config.Sentry != nil {
Expand Down Expand Up @@ -112,8 +115,6 @@ func (s *HTTPServer) Init() error {
}))
}

router.GET("/healthcheck", handlers.healthcheck(time.Now().UTC()))

restrictIPAddresses := middleware.RestrictIPAddresses(s.config.Options.AllowedIPAddresses)

if s.config.Options.EnableStats {
Expand Down

0 comments on commit 7019f5b

Please sign in to comment.