예제 #1
0
        public MvcLogEventFixtures()
        {
            _context = ObjectMother.CreateActionActionExecutedContextFake();
            _expectedUrl = _context.RequestContext.HttpContext.Request.RawUrl;
            _expectedControllerName = _context.ActionDescriptor.ControllerDescriptor.ControllerName;
            _expectedActionName = _context.ActionDescriptor.ActionName;

            _sut = new MvcLogEvent(_context);
        }
예제 #2
0
 public override void OnActionExecuted(ActionExecutedContext context)
 {
     if (!Enabled) return;
     var logEvent = new MvcLogEvent(context);
     var log = LogManager.GetLogger(context.Controller.GetType());
     if (logEvent.IsHttpGet)
     {
         log.Debug(logEvent);
     }
     else
     {
         log.Info(logEvent);
     }
     base.OnActionExecuted(context);
 }
예제 #3
0
파일: LogAttribute.cs 프로젝트: theteng/Mvc
        public override void OnActionExecuted(ActionExecutedContext context)
        {
            if (!Enabled)
            {
                return;
            }
            var logEvent = new MvcLogEvent(context);
            var log      = LogManager.GetLogger(context.Controller.GetType());

            if (logEvent.IsHttpGet)
            {
                log.Debug(logEvent);
            }
            else
            {
                log.Info(logEvent);
            }
            base.OnActionExecuted(context);
        }