[question] How to handle invalid paths for Logging Purposes.
ACodingGenie opened this issue · comments
Hi, so I'm attempting to design a few endpoints for my API in Go using Gorilla Mux but the issue I'm running into is handling invalid paths for logging. Currently, I use a regex as shown in the screenshot below for invalid paths but this won't capture all the invalid routes. It only captures until the next '/'. I would like for it be able to capture all paths no matter the length or how ever many '/' there are. I realize it returns a 404 status code, but I can't log it. I would rather return that 404 code myself and log it while doing so. Is this something possible to do with Mux? Thanks.
Versions
Go version:
go version
1.15.3
How did you solve this?
@muety I just kept it as is. Let me know if you'd like me to reopen the issue.
I managed to solve it like this in the meanwhile: https://github.com/muety/wakapi/blob/4d2a160ccb0cbcc1d89f48a966b54bf0576fee5e/main.go#L193