Beispiel #1
0
        public static void WriteLog(HttpContext context, Exception exception)
        {
            var mo = GetLog(context);

            mo.LogLevel   = "E";
            mo.LogGroup   = "-1";
            mo.LogContent = exception.Message;

            LoggingTo.Add(mo);
        }
Beispiel #2
0
            public override void OnActionExecuting(ActionExecutingContext context)
            {
                //日志

                var hc = context.HttpContext;

                if (string.IsNullOrWhiteSpace(hc.Request.Query["__nolog"].ToString()))
                {
                    string controller = context.RouteData.Values["controller"].ToString().ToLower();
                    string action     = context.RouteData.Values["action"].ToString().ToLower();

                    //日志保存
                    var mo = GetLog(context.HttpContext);
                    mo.LogAction = controller + "/" + action;
                    if (DicDescription.ContainsKey(mo.LogAction))
                    {
                        mo.LogContent = DicDescription[mo.LogAction];
                    }

                    LoggingTo.Add(mo);
                }

                base.OnActionExecuting(context);
            }