|
|
@ -130,7 +130,7 @@ public class AuditingInterceptor : AbpInterceptor, ITransientDependency |
|
|
} |
|
|
} |
|
|
finally |
|
|
finally |
|
|
{ |
|
|
{ |
|
|
if (ShouldWriteAuditLog(invocation, options, currentUser, hasError)) |
|
|
if (await ShouldWriteAuditLogAsync(invocation, auditingManager.Current.Log, options, currentUser, hasError)) |
|
|
{ |
|
|
{ |
|
|
if (unitOfWorkManager.Current != null) |
|
|
if (unitOfWorkManager.Current != null) |
|
|
{ |
|
|
{ |
|
|
@ -153,12 +153,21 @@ public class AuditingInterceptor : AbpInterceptor, ITransientDependency |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private bool ShouldWriteAuditLog( |
|
|
private async Task<bool> ShouldWriteAuditLogAsync( |
|
|
IAbpMethodInvocation invocation, |
|
|
IAbpMethodInvocation invocation, |
|
|
|
|
|
AuditLogInfo auditLogInfo, |
|
|
AbpAuditingOptions options, |
|
|
AbpAuditingOptions options, |
|
|
ICurrentUser currentUser, |
|
|
ICurrentUser currentUser, |
|
|
bool hasError) |
|
|
bool hasError) |
|
|
{ |
|
|
{ |
|
|
|
|
|
foreach (var selector in options.AlwaysLogSelectors) |
|
|
|
|
|
{ |
|
|
|
|
|
if (await selector(auditLogInfo)) |
|
|
|
|
|
{ |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (options.AlwaysLogOnException && hasError) |
|
|
if (options.AlwaysLogOnException && hasError) |
|
|
{ |
|
|
{ |
|
|
return true; |
|
|
return true; |
|
|
|