diff --git a/src/Serval.Shared/Controllers/ErrorResultFilter.cs b/src/Serval.Shared/Controllers/ErrorResultFilter.cs index 68207df8..a928aeb2 100644 --- a/src/Serval.Shared/Controllers/ErrorResultFilter.cs +++ b/src/Serval.Shared/Controllers/ErrorResultFilter.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using System.Text.Json; namespace Serval.Shared.Controllers { @@ -15,7 +16,9 @@ public override Task OnResultExecutionAsync(ResultExecutingContext context, Resu { if ((context.Result is ObjectResult r) && (r.StatusCode >= 400)) { - _logger.LogInformation($"Responded with code {r.StatusCode}. Trace: {Activity.Current?.Id}"); + _logger.LogInformation( + $"Client {((Controller)context.Controller).User.Identity?.Name?.ToString()} made request:\n {JsonSerializer.Serialize(((Controller)context.Controller).ControllerContext.RouteData.Values, new JsonSerializerOptions { WriteIndented = true })}.\n Serval responded with code {r.StatusCode}. Trace: {Activity.Current?.Id}" + ); } return base.OnResultExecutionAsync(context, next); }