From 5515063cc388366feb487711cf39a93a74d52f71 Mon Sep 17 00:00:00 2001 From: John Lambert Date: Thu, 12 Sep 2024 12:16:58 -0400 Subject: [PATCH] Be explicit about engineId in every log Only log 500 codes --- .../src/Serval.Shared/Controllers/ErrorResultFilter.cs | 2 +- .../Controllers/TranslationEnginesController.cs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Serval/src/Serval.Shared/Controllers/ErrorResultFilter.cs b/src/Serval/src/Serval.Shared/Controllers/ErrorResultFilter.cs index ab8e3903..78ed4711 100644 --- a/src/Serval/src/Serval.Shared/Controllers/ErrorResultFilter.cs +++ b/src/Serval/src/Serval.Shared/Controllers/ErrorResultFilter.cs @@ -7,7 +7,7 @@ public class ErrorResultFilter(ILoggerFactory loggerFactory) : IAlwaysRunResultF public void OnResultExecuted(ResultExecutedContext context) { - if (context.HttpContext.Response.StatusCode >= 400) + if (context.HttpContext.Response.StatusCode >= 500) { _logger.LogInformation( "Client {client} made request:\n {request}.\n Serval responded with code {statusCode}. Trace: {activityId}", diff --git a/src/Serval/src/Serval.Translation/Controllers/TranslationEnginesController.cs b/src/Serval/src/Serval.Translation/Controllers/TranslationEnginesController.cs index 052d7ede..31d69846 100644 --- a/src/Serval/src/Serval.Translation/Controllers/TranslationEnginesController.cs +++ b/src/Serval/src/Serval.Translation/Controllers/TranslationEnginesController.cs @@ -704,7 +704,12 @@ CancellationToken cancellationToken ); if (usfm == "") return NoContent(); - _logger.LogInformation("Returning USFM for {TextId} in {CorpusId} of {EngineId}", textId, corpusId, id); + _logger.LogInformation( + "Returning USFM for {TextId} in engine {EngineId} for corpus {corpusId}", + textId, + id, + corpusId + ); return Content(usfm, "text/plain"); }