Skip to content
This repository was archived by the owner on Oct 28, 2022. It is now read-only.

Commit 0b2457b

Browse files
committed
don't log /api/v1/health
1 parent 30f6176 commit 0b2457b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

helpers/requestLogger/requestLogger.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ func New() fiber.Handler {
2424
}()
2525

2626
return func(c *fiber.Ctx) (err error) {
27+
path := c.Path()
28+
if path == "/api/v1/health" {
29+
// This URL is request a lot it and there isn't much value logging it
30+
// If anything it bloats the logs
31+
return c.Next()
32+
}
33+
2734
start := time.Now()
2835
err = c.Next()
2936
reqDuration := time.Since(start).Microseconds()
@@ -67,7 +74,7 @@ func New() fiber.Handler {
6774
fmt.Print(method)
6875
fmt.Print(strings.Repeat(" ", 7-len(method)))
6976
fmt.Print("| ")
70-
fmt.Print(c.Path())
77+
fmt.Print(path)
7178
if err != nil {
7279
fmt.Print(" | ERR: ")
7380
fmt.Print(err)

0 commit comments

Comments
 (0)