Skip logging of health check requests
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"git.pbiernat.dev/egommerce/go-api-pkg/fluentd"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
@@ -20,6 +22,11 @@ func SetupMiddlewares(s *Server) {
|
||||
// Middlewares
|
||||
func LoggingMiddleware(log *fluentd.Logger) func(c *fiber.Ctx) error {
|
||||
return func(c *fiber.Ctx) error {
|
||||
path := string(c.Request().URI().Path())
|
||||
if strings.Contains(path, "/health") {
|
||||
return c.Next()
|
||||
}
|
||||
|
||||
log.Log("Request: %s, remote: %s, via: %s",
|
||||
c.Request().URI().String(),
|
||||
c.Context().RemoteIP().String(),
|
||||
|
||||
Reference in New Issue
Block a user