Created
December 18, 2023 16:46
-
-
Save renatogroffe/fa9a397b64b4531e596638a629d5644a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace APIContagem.Middlewares; | |
public class MiddlewareExecutionNotificator | |
{ | |
private readonly RequestDelegate _next; | |
public MiddlewareExecutionNotificator(RequestDelegate next) | |
{ | |
_next = next; | |
} | |
public async Task Invoke(HttpContext httpContext) | |
{ | |
var logger = (ILogger<MiddlewareExecutionNotificator>)httpContext | |
.RequestServices.GetService(typeof(ILogger<MiddlewareExecutionNotificator>))!; | |
logger.LogWarning("MiddlewareExecutionNotificator - Inicio da execucao"); | |
await _next(httpContext); | |
logger.LogWarning("MiddlewareExecutionNotificator - Fim da execucao"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment