You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
My main problem is that I want to log more when there has been an exception. And the response code at this point is still 200 in the httpContext.Response object. So I need a separate custom middleware to achieve the desired result.
Describe the solution you'd like
So pass either the ex variable (just like to _getLevel) or the statusCode so I don't need one more Middleware to just do logging when there has been an exception.
Describe alternatives you've considered
You can add an extra Middleware that add these variables to the DiagnosticContext itself.
Extra context
For example:
if(httpContext.Response.StatusCode>499){// attach immense amounts of stuff. for later debugging}
Does not work with Exceptions, since the StatusCode is still 200 at that point the 500 gets passed as a different parameter in the Middleware completion function.
I'd like to do something like:
if(ex!=null||statusCode>499){// attach immense amounts of stuff. for later debugging}
I'm not sure how you could add these two without breaking existing code, even if it would be an easy fix with the new discarded _ arguments for users.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
My main problem is that I want to log more when there has been an exception. And the response code at this point is still 200 in the httpContext.Response object. So I need a separate custom middleware to achieve the desired result.
Describe the solution you'd like
So pass either the ex variable (just like to
_getLevel
) or the statusCode so I don't need one more Middleware to just do logging when there has been an exception.Describe alternatives you've considered
You can add an extra Middleware that add these variables to the DiagnosticContext itself.
Extra context
For example:
Does not work with Exceptions, since the StatusCode is still 200 at that point the 500 gets passed as a different parameter in the Middleware completion function.
I'd like to do something like:
I'm not sure how you could add these two without breaking existing code, even if it would be an easy fix with the new discarded
_
arguments for users.The text was updated successfully, but these errors were encountered: