about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2024-04-18 17:24:41 +0200
committerAlan Pearce2024-04-18 17:47:17 +0200
commit477c7bf60099cf33984894744846a278fc884786 (patch)
tree0a9ca6214ab7742be527012247bf5ae522dbeb40
parent320d0cbf276a89ac38e3b90b8cfc129a721adf95 (diff)
downloadwebsite-477c7bf60099cf33984894744846a278fc884786.tar.lz
website-477c7bf60099cf33984894744846a278fc884786.tar.zst
website-477c7bf60099cf33984894744846a278fc884786.zip
disable logging of healthcheck requests
-rw-r--r--server.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/server.go b/server.go
index c588efb..dc8ea7b 100644
--- a/server.go
+++ b/server.go
@@ -20,6 +20,7 @@ import (
 	"github.com/gofiber/fiber/v2/middleware/healthcheck"
 	"github.com/gofiber/fiber/v2/middleware/logger"
 	"github.com/gofiber/fiber/v2/middleware/recover"
+	"github.com/gofiber/fiber/v2/middleware/skip"
 
 	"github.com/shengyanli1982/law"
 )
@@ -120,9 +121,11 @@ func main() {
 	toplevel.Get("/health", func(c *fiber.Ctx) error {
 		return c.SendStatus(fiber.StatusOK)
 	})
-	toplevel.Use(logger.New(logger.Config{
+	toplevel.Use(skip.New(logger.New(logger.Config{
 		Output: law.NewWriteAsyncer(os.Stdout, nil),
 		Format: "${protocol} ${method} ${status} ${host} ${url} ${respHeader:Location}\n",
+	}), func(c *fiber.Ctx) bool {
+		return c.Hostname() != "fly-internal"
 	}))
 	toplevel.Use(func(c *fiber.Ctx) error {
 		host := hosts[c.Hostname()]