/// <summary> /// 写入API异常日志 /// </summary> /// <param name="apiRoute">API路由</param> /// <param name="postData">接口输入参数</param> /// <param name="message">异常消息</param> /// <param name="stackTrace">异常堆栈信息</param> public void ExceptionLog(string apiRoute, string postData, string message, string stackTrace) { var log = new APIExceptionLog(); log.APIRoute = apiRoute; log.PostData = postData; log.Message = message; log.StackTrace = stackTrace; log.InDate = DateTime.Now; this.Context.APIExceptionLogs.Add(log); this.Context.SaveChanges(); }