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); }
public string QueryLog(int page, int rows) { var now = DateTime.Now; var vm = LoggingTo.Query(now.AddYears(-5), now, page, rows); return(new { data = vm.Data, total = vm.Total, lost = vm.Lost }.ToJson()); }
public LoggingResultVM QueryLogReportTop(int?type, string field, string LogGroup) { Dictionary <string, string> dicWhere = null; if (!string.IsNullOrWhiteSpace(LogGroup)) { dicWhere = new Dictionary <string, string> { { "LogGroup", LogGroup } }; } var vm = LoggingTo.StatsTop(type ?? 0, field, dicWhere); return(vm); }
public LoggingResultVM QueryLogReportTop(int?type, string field, string LogGroup) { var listWhere = new List <List <string> >(); if (!string.IsNullOrWhiteSpace(LogGroup)) { listWhere = new List <List <string> > { new List <string> { "LogGroup", "=", LogGroup } }; } var vm = LoggingTo.StatsTop(type ?? 0, field, listWhere); return(vm); }
public string QueryLog(int page, int rows, string wheres) { var now = DateTime.Now; List <List <string> > listWhere = new(); try { if (!string.IsNullOrWhiteSpace(wheres)) { var jws = JArray.Parse(wheres); foreach (var wi in jws) { var w1 = wi[0]?.ToString(); var w2 = wi[1]?.ToString(); var w3 = wi[2]?.ToString(); if (!string.IsNullOrWhiteSpace(w2) && !string.IsNullOrWhiteSpace(w3)) { listWhere.Add(new List <string> { w1, w2, w3 }); } } } } catch (Exception ex) { Console.WriteLine(ex); listWhere = null; } var vm = LoggingTo.Query(now.AddYears(-5), now, page, rows, listWhere); return(new { data = vm.Data, total = vm.Total, lost = vm.Lost }.ToJson()); }
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); }