diff options
author | Alan Pearce | 2024-04-18 17:24:41 +0200 |
---|---|---|
committer | Alan Pearce | 2024-04-18 17:47:17 +0200 |
commit | 477c7bf60099cf33984894744846a278fc884786 (patch) | |
tree | 0a9ca6214ab7742be527012247bf5ae522dbeb40 /server.go | |
parent | 320d0cbf276a89ac38e3b90b8cfc129a721adf95 (diff) | |
download | website-477c7bf60099cf33984894744846a278fc884786.tar.lz website-477c7bf60099cf33984894744846a278fc884786.tar.zst website-477c7bf60099cf33984894744846a278fc884786.zip |
disable logging of healthcheck requests
Diffstat (limited to 'server.go')
-rw-r--r-- | server.go | 5 |
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()] |