HTTP request/response logger for Fiber using zerolog.
go get -u github.com/gofiber/fiber
go get -u github.com/dre1080/fiberlog
package main
import (
"github.com/gofiber/fiber"
"github.com/dre1080/fiberlog"
)
func main() {
app := fiber.New()
// Default
app.Use(fiberlog.New())
// Custom Config
app.Use(fiberlog.New(fiberlog.Config{
Logger: &zerolog.New(os.Stdout),
Next: func(ctx *fiber.Ctx) bool {
// skip if we hit /private
return ctx.Path() == "/private"
},
}))
app.Listen(3000)
}
Run app server:
$ go run example/main.go
Test request:
$ curl http://localhost:3000/ok
$ curl http://localhost:3000/warn
$ curl http://localhost:3000/err