Exemple #1
0
        public override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            //在Result執行之後
            //filterContext.HttpContext.Response.Write(@"<br />After ViewResult execute" + "\t " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fffff"));
            var renderTimer = getTimer(filterContext, "render");

            renderTimer.Stop();

            var actionTimer = getTimer(filterContext, "action");
            var msg         = String.Format(
                "Action '{0}/{1}', Execute: {2} , Render: {3} .",
                filterContext.RouteData.Values["controller"],
                filterContext.RouteData.Values["action"],
                getTimeDesc(actionTimer.ElapsedTicks),
                getTimeDesc(renderTimer.ElapsedTicks)
                );
            var log = new PerformanceLog();

            log.LogContent = msg;
            log.post();
            base.OnResultExecuted(filterContext);
        }
        protected override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            //在Result執行之後
            //filterContext.HttpContext.Response.Write(@"<br />After ViewResult execute" + "\t " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fffff"));
            var renderTimer = getTimer(filterContext, "render");

            renderTimer.Stop();

            var actionTimer = getTimer(filterContext, "action");
            var msg         = String.Format(
                "Action({0}) '{1}/{2}', Execute: {3:c} , Render: {4:c}.",
                filterContext.HttpContext.Request.HttpMethod,
                filterContext.RouteData.Values["controller"],
                filterContext.RouteData.Values["action"],
                actionTimer.Elapsed,
                renderTimer.Elapsed
                );
            var log = new PerformanceLog();

            log.LogContent = msg;
            log.post();
            base.OnResultExecuted(filterContext);
        }