Exemplo n.º 1
0
 private void LogUserLogged(User user)
 {
     Common.CSVLogger.CSVLogger.Instance.Log(new Common.CSVLogger.CSVLog
     {
         Action      = ActionContext.ActionDescriptor.ActionName,
         Controller  = ActionContext.ControllerContext.ControllerDescriptor.ControllerName,
         Date        = DateTime.UtcNow,
         Description = "User Logged in",
         IP          = IPUtils.GetClientIp(Request),
         UserEmail   = user.Email,
         Username    = user.UserName
     });
 }
Exemplo n.º 2
0
        public void LogAction(System.Web.Http.Filters.HttpActionExecutedContext actionExecutedContext, ActionLogger actionLogger)
        {
            var log = new CSVLog
            {
                Action      = actionExecutedContext.ActionContext.ActionDescriptor.ActionName,
                Controller  = actionExecutedContext.ActionContext.ControllerContext.ControllerDescriptor.ControllerName,
                Date        = DateTime.UtcNow,
                Description = actionLogger.getDescription(actionExecutedContext),
                IP          = IPUtils.GetClientIp(actionExecutedContext.Request)
            };

            var user = Common.UserUtils.GetUser(actionExecutedContext.Request);

            if (user != null)
            {
                log.UserEmail = user.Email;
                log.Username  = user.UserName;
            }

            Log(log);
        }