예제 #1
0
        public IActionResult Index()
        {
            var timer = _performanceLogger.StartTimer();

            Thread.Sleep(2000);
            timer.LogElapsedTime();

            return(View());
        }
예제 #2
0
        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;
            }
        }