Describe the solution you'd like
Google cloud platform's logging can viewed with structured logging, it would be good to have one.
Describe alternatives you've considered
I have tried using zap, writing a custom logger, but for some reason the status code comes as 200, and then there is an error.
Thanks for opening your first issue here! ๐ Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord
Hey @akshaybabloo Do you mean the middleware logger should support structured logging(e.g. json)?
Ya it would render something like this on GCP:

How about this:
package main
import (
"github.com/gofiber/fiber"
"github.com/gofiber/fiber/middleware"
)
func main() {
app := fiber.New()
app.Use(middleware.Logger(`{"pid":${pid}, "timestamp":"${time}", "status":${status}, "latency":"${latency}", "method":"${method}", "path":"${path}"}` + "\n"))
app.Get("/", func(_ *fiber.Ctx) {})
app.Listen(3000)
}
And log contents are:
{"pid":21327, "timestamp":"2020/07/29 13:41:03", "status":200, "latency":"0s ", "method":"GET", "path":"/"}
{"pid":21327, "timestamp":"2020/07/29 13:46:53", "status":200, "latency":"0s ", "method":"GET", "path":"/"}
Btw, the output maybe has small defects ("latency":"0s ") now.
OK I will give that a try. thank you.
Feel free to re-open this issue if you have any further question.
Hello!, taking the title as structured logger, I started using go and gofiber recently (so very new , but enthusiastic!).
So I am using the middleware logger to record the requests , but what if I I want to record other events f.e. in gracefully shutdown recipe, I can use logger to save the cleaning tasks. Or simply , to log some events inside the handler. Or to log errors .
What is your approach or recommended guideline for this? keeping everything in one file? I was initially considering to use the middleware logger (but did not figure out how to do it). But now I think that it does not make sense to use it for other reasons than middleware things.
Most helpful comment
How about this:
And log contents are:
Btw, the output maybe has small defects (
"latency":"0s ") now.