elmah-contrib-webapi
elmah-contrib-webapi copied to clipboard
Allow selection of which errors to log in the attribute declaration
It'd be nice if we could optionally log 400 and 404s. I understand the reasoning in #13, but everyone's use case is different.
What about [ElmahHandleErrorApi(LoggedErrors="400,500-999")] or similar?
Hi @voltagex, did you ever end up solving this? I was thinking something along the lines of:
[ElmahHandleErrorApi(Include.AllExcept, 404, 403, 401)]
[ElmahHandleErrorApi(Include.AllExcept, HttpErrorCodeRange.5xx, HttpErrorCodeRange.4xx)]
[ElmahHandleErrorApi(Include.Only, HttpErrorCodeRange.5xx)]
Or multiple attributes working together:
[ElmahHandleErrorApi, Include(HttpErrorCodeRange.5xx), Exclude(500)]
I also ran into this today too. I would like to see 400 errors. For example, when ModelState is invalid a "400 Bad Request" response is returned. In my case, this invalid request would be coming from my front-end written in Angluar (which doesn't log errors, other than to the browser console). So if I get a support ticket that the user got "some weird error", I could at least go and see this in Elmah and determine if there is a bug in the UI code.