|
|
|
@ -22,7 +22,7 @@ public class GlobalExceptionsFilter : IExceptionFilter
|
|
|
|
|
private readonly SqlSugarScope db;
|
|
|
|
|
public GlobalExceptionsFilter(IHostingEnvironment env, IServiceProvider serviceProvider)
|
|
|
|
|
{
|
|
|
|
|
_env = env;
|
|
|
|
|
_env = env;
|
|
|
|
|
_serviceProvider = serviceProvider;
|
|
|
|
|
db = (SqlSugarScope)_serviceProvider.GetRequiredService<ISqlSugarClient>();
|
|
|
|
|
}
|
|
|
|
@ -56,13 +56,17 @@ public class GlobalExceptionsFilter : IExceptionFilter
|
|
|
|
|
|
|
|
|
|
#region 写入日志库
|
|
|
|
|
|
|
|
|
|
var className = context.Exception.TargetSite.DeclaringType?.FullName;
|
|
|
|
|
var groupCollection = Regex.Match(className, "<(.*?)>").Groups;
|
|
|
|
|
var methodName = "";
|
|
|
|
|
if (groupCollection.Count > 1)
|
|
|
|
|
string? methodName = "";
|
|
|
|
|
string? className = context.Exception.TargetSite?.DeclaringType?.FullName ?? "";
|
|
|
|
|
if (!string.IsNullOrEmpty(className))
|
|
|
|
|
{
|
|
|
|
|
methodName = groupCollection[1].Value;
|
|
|
|
|
var groupCollection = Regex.Match(className, "<(.*?)>").Groups;
|
|
|
|
|
if (groupCollection.Count > 1)
|
|
|
|
|
{
|
|
|
|
|
methodName = groupCollection[1].Value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var exLog = new SysLogException()
|
|
|
|
|
{
|
|
|
|
|
ClassName = className,
|
|
|
|
|