public IActionResult Index() { var timer = _performanceLogger.StartTimer(); Thread.Sleep(2000); timer.LogElapsedTime(); return(View()); }
public async Task Invoke(HttpContext httpContext) { var timer = _performanceLogger.StartTimer(); try { await _next(httpContext); timer.LogElapsedTime(_middlewareName); } catch (Exception ex) { timer.LogElapsedTime($"{_middlewareName} exception"); throw; } }