| | |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.Extensions.Logging; |
| | | using Newtonsoft.Json; |
| | | using Org.BouncyCastle.Asn1.Ocsp; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Net; |
| | | using System.Text; |
| | | using System.Text.RegularExpressions; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.LogHelper; |
| | | |
| | |
| | | public class ApiLogMiddleware |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// |
| | | /// </summary> |
| | | private readonly RequestDelegate _next; |
| | | |
| | |
| | | var json = new WebResponseContent(); |
| | | |
| | | json.Message = HttpStatusCode.InternalServerError.ToString();//错误信息 |
| | | json.Code = 500;//500异常 |
| | | json.Code = 500;//500异常 |
| | | |
| | | StreamWriter streamWriter = new StreamWriter(context.Response.Body); |
| | | await streamWriter.WriteAsync(json.Serialize()); |
| | |
| | | catch (Exception ex) |
| | | { |
| | | // 记录异常 |
| | | |
| | | } |
| | | finally |
| | | { |
| | |
| | | return ""; |
| | | } |
| | | } |
| | | } |
| | | } |