|
|
|
@ -28,9 +28,21 @@ namespace Squidex.Web.Pipeline |
|
|
|
|
|
|
|
public async Task InvokeAsync(HttpContext context, ISemanticLog log) |
|
|
|
{ |
|
|
|
var watch = ValueStopwatch.StartNew(); |
|
|
|
var shouldStartSession = requestLogOptions.LogRequests || Profiler.HasListener; |
|
|
|
|
|
|
|
using (Profiler.StartSession()) |
|
|
|
if (requestLogOptions.LogRequests || shouldStartSession) |
|
|
|
{ |
|
|
|
var session = |
|
|
|
shouldStartSession ? |
|
|
|
Profiler.StartSession() : |
|
|
|
default; |
|
|
|
|
|
|
|
var watch = |
|
|
|
requestLogOptions.LogRequests ? |
|
|
|
ValueStopwatch.StartNew() : |
|
|
|
default; |
|
|
|
|
|
|
|
using (session) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
@ -38,10 +50,10 @@ namespace Squidex.Web.Pipeline |
|
|
|
} |
|
|
|
finally |
|
|
|
{ |
|
|
|
var elapsedMs = watch.Stop(); |
|
|
|
|
|
|
|
if (requestLogOptions.LogRequests) |
|
|
|
{ |
|
|
|
var elapsedMs = watch.Stop(); |
|
|
|
|
|
|
|
log.LogInformation((elapsedMs, context), (ctx, w) => |
|
|
|
{ |
|
|
|
if (requestLogOptions.LogProfiler) |
|
|
|
@ -56,6 +68,11 @@ namespace Squidex.Web.Pipeline |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
await next(context); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static void LogFilters(HttpContext httpContext, IObjectWriter c) |
|
|
|
{ |
|
|
|
|