Funktion: Hinzufügen von strukturierten Logging-Erweiterungen und Korrektur eines Parameterfehlers

- Hinzufügen der Methoden `LogMessageList` und `LogServiceMessage` für verbessertes Nachrichten-Logging.
- Korrektur der Schreibweise des Parameters `separator`.
- Dokumentation der Methoden für bessere Klarheit.
This commit is contained in:
Developer 02
2024-04-19 10:05:43 +02:00
parent 052448b6bf
commit ce462a8b66
8 changed files with 104 additions and 9 deletions

View File

@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using DigitalData.Core.Contracts.Application;
using Microsoft.AspNetCore.Mvc;
using System.Text;
namespace DigitalData.Core.API
@@ -44,5 +45,15 @@ namespace DigitalData.Core.API
return controllerBase.StatusCode(500, sb.Length > 0 ? sb.ToString() : null);
}
/// <summary>
/// Returns an ObjectResult representing an internal server error (status code 500) with optional exception and message details.
/// </summary>
/// <param name="controllerBase">The ControllerBase instance representing the controller.</param>
/// <param name="ex">Optional. The exception that occurred, if any.</param>
/// <param name="message">Optional. A custom error message to include in the response.</param>
/// /// <param name="messageKey">Optional. A custom error message key to include in the response.</param>
/// <returns>An ObjectResult representing an internal server error (status code 500).</returns>
public static ObjectResult InnerServiceError(this ControllerBase controllerBase, IServiceMessage? serviceMessage = null) => controllerBase.StatusCode(500, serviceMessage);
}
}