/// <summary> /// 添加日志 /// </summary> /// <param name="log"></param> public static void Post(HttpContext context, PrcServer_UserOperationLog log) { if (GetDbLogValue()) { GetBaseLog(context, log); batchLogs.Post(log); } }
private static void GetBaseLog(HttpContext context, PrcServer_UserOperationLog log) { if (context != null) { log.ClientIP = GetUserIpAddress(context); log.CreateBy = context.User?.Identity?.Name; log.CreateTime = DateTime.Now; log.EndTime = log.CreateTime; log.UserAgent = context.Request.UserAgent; log.Url = context.Request.Url.AbsoluteUri; log.Source = GetTerminalType(log.UserAgent); } }