|
|
|
@ -31,11 +31,12 @@ namespace Volo.Abp.AuditLogging.MongoDB |
|
|
|
string correlationId = null, |
|
|
|
int? maxDuration = null, |
|
|
|
int? minDuration = null, |
|
|
|
bool? hasException = null, |
|
|
|
HttpStatusCode? httpStatusCode = null, |
|
|
|
bool includeDetails = false, |
|
|
|
CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
var query = GetListQuery(httpMethod, url, userName, applicationName, correlationId, maxDuration, minDuration, httpStatusCode, includeDetails); |
|
|
|
var query = GetListQuery(httpMethod, url, userName, applicationName, correlationId, maxDuration, minDuration, hasException, httpStatusCode, includeDetails); |
|
|
|
|
|
|
|
return await query.OrderBy(sorting ?? "executionTime desc").As<IMongoQueryable<AuditLog>>() |
|
|
|
.PageBy<AuditLog, IMongoQueryable<AuditLog>>(skipCount, maxResultCount) |
|
|
|
@ -50,10 +51,11 @@ namespace Volo.Abp.AuditLogging.MongoDB |
|
|
|
string correlationId = null, |
|
|
|
int? maxDuration = null, |
|
|
|
int? minDuration = null, |
|
|
|
bool? hasException = null, |
|
|
|
HttpStatusCode? httpStatusCode = null, |
|
|
|
CancellationToken cancellationToken = default) |
|
|
|
{ |
|
|
|
var query = GetListQuery(httpMethod, url, userName, applicationName, correlationId, maxDuration, minDuration, httpStatusCode); |
|
|
|
var query = GetListQuery(httpMethod, url, userName, applicationName, correlationId, maxDuration, minDuration, hasException, httpStatusCode); |
|
|
|
|
|
|
|
var count = await query.As<IMongoQueryable<AuditLog>>().LongCountAsync(); |
|
|
|
|
|
|
|
@ -68,10 +70,13 @@ namespace Volo.Abp.AuditLogging.MongoDB |
|
|
|
string correlationId = null, |
|
|
|
int? maxDuration = null, |
|
|
|
int? minDuration = null, |
|
|
|
bool? hasException = null, |
|
|
|
HttpStatusCode? httpStatusCode = null, |
|
|
|
bool includeDetails = false) |
|
|
|
{ |
|
|
|
return GetMongoQueryable() |
|
|
|
.WhereIf(hasException.HasValue && hasException.Value, auditLog => auditLog.Exceptions != null && auditLog.Exceptions.Length > 0) |
|
|
|
.WhereIf(hasException.HasValue && !hasException.Value, auditLog => auditLog.Exceptions == null || auditLog.Exceptions.Length == 0) |
|
|
|
.WhereIf(httpMethod != null, auditLog => auditLog.HttpMethod != null && auditLog.HttpMethod.ToLowerInvariant() == httpMethod.ToLowerInvariant()) |
|
|
|
.WhereIf(url != null, auditLog => auditLog.Url != null && auditLog.Url.ToLowerInvariant().Contains(url.ToLowerInvariant())) |
|
|
|
.WhereIf(userName != null, auditLog => auditLog.UserName != null && auditLog.UserName.ToLowerInvariant() == userName.ToLowerInvariant()) |
|
|
|
@ -79,7 +84,7 @@ namespace Volo.Abp.AuditLogging.MongoDB |
|
|
|
.WhereIf(correlationId != null, auditLog => auditLog.CorrelationId != null && auditLog.CorrelationId.ToLowerInvariant() == correlationId.ToLowerInvariant()) |
|
|
|
.WhereIf(httpStatusCode != null && httpStatusCode > 0, auditLog => auditLog.HttpStatusCode == (int?)httpStatusCode) |
|
|
|
.WhereIf(maxDuration != null && maxDuration > 0, auditLog => auditLog.ExecutionDuration <= maxDuration) |
|
|
|
.WhereIf(minDuration != null && minDuration > 0, auditLog => auditLog.ExecutionDuration >= minDuration); ; |
|
|
|
.WhereIf(minDuration != null && minDuration > 0, auditLog => auditLog.ExecutionDuration >= minDuration); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|