优化日志记录
This commit is contained in:
parent
af07ffc5d1
commit
7bbb076c0e
@ -76,7 +76,7 @@ namespace ZR.Admin.WebApi.Filters
|
|||||||
Data = url
|
Data = url
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
ContentType = "text/json",
|
ContentType = "application/json",
|
||||||
};
|
};
|
||||||
context.Result = result;
|
context.Result = result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
using Infrastructure.Attribute;
|
using Infrastructure.Attribute;
|
||||||
|
using Infrastructure.Model;
|
||||||
using IPTools.Core;
|
using IPTools.Core;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using NLog;
|
using NLog;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@ -41,11 +43,14 @@ namespace ZR.Admin.WebApi.Filters
|
|||||||
// 获取当前的用户
|
// 获取当前的用户
|
||||||
string userName = context.HttpContext.GetName();
|
string userName = context.HttpContext.GetName();
|
||||||
string jsonResult = string.Empty;
|
string jsonResult = string.Empty;
|
||||||
|
|
||||||
if (context.Result is ContentResult result && result.ContentType == "application/json")
|
if (context.Result is ContentResult result && result.ContentType == "application/json")
|
||||||
{
|
{
|
||||||
jsonResult = result.Content.Replace("\r\n", "").Trim();
|
jsonResult = result.Content.Replace("\r\n", "").Trim();
|
||||||
}
|
}
|
||||||
|
if (context.Result is JsonResult result2)
|
||||||
|
{
|
||||||
|
jsonResult = result2.Value?.ToString();
|
||||||
|
}
|
||||||
//获取当前执行方法的类名
|
//获取当前执行方法的类名
|
||||||
//string className = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name;
|
//string className = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name;
|
||||||
//获取当前成员的名称
|
//获取当前成员的名称
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user