mirror of https://github.com/Squidex/squidex.git
16 changed files with 151 additions and 65 deletions
@ -0,0 +1,6 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<RunSettings> |
||||
|
<RunConfiguration> |
||||
|
<MaxCpuCount>4</MaxCpuCount> |
||||
|
</RunConfiguration> |
||||
|
</RunSettings> |
||||
@ -0,0 +1,42 @@ |
|||||
|
// ==========================================================================
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
||||
|
// All rights reserved. Licensed under the MIT license.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
using System; |
||||
|
using GraphQL.Instrumentation; |
||||
|
using Squidex.Infrastructure; |
||||
|
using Squidex.Infrastructure.Log; |
||||
|
|
||||
|
namespace Squidex.Domain.Apps.Entities.Contents.GraphQL |
||||
|
{ |
||||
|
public static class LoggingMiddleware |
||||
|
{ |
||||
|
public static Func<FieldMiddlewareDelegate, FieldMiddlewareDelegate> Create(ISemanticLog log) |
||||
|
{ |
||||
|
Guard.NotNull(log, nameof(log)); |
||||
|
|
||||
|
return new Func<FieldMiddlewareDelegate, FieldMiddlewareDelegate>(next => |
||||
|
{ |
||||
|
return async context => |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
return await next(context); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
log.LogWarning(ex, w => w |
||||
|
.WriteProperty("action", "reolveField") |
||||
|
.WriteProperty("status", "failed") |
||||
|
.WriteProperty("field", context.FieldName)); |
||||
|
|
||||
|
throw ex; |
||||
|
} |
||||
|
}; |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue