- Ersetzung von ITranslateService durch IStringLocalizer<X> für verbesserte Lokalisierung. - Aktualisierung der DTO-Klassen entsprechend der neuesten Core.DTO-Struktur. - Integration der neuen Klassen Result und DataResult aus Core.DTO für standardisierte Serviceantworten.
43 lines
1.6 KiB
C#
43 lines
1.6 KiB
C#
using EnvelopeGenerator.Application.Services;
|
|
using Microsoft.Extensions.Logging;
|
|
using System.Text;
|
|
|
|
namespace EnvelopeGenerator.Application
|
|
{
|
|
public static class EnvelopeGeneratorExtensions
|
|
{
|
|
public static void LogEnvelopeError(this ILogger logger, string envelopeEeceiverId, Exception? exception = null, string? message = null, params object?[] args)
|
|
{
|
|
var sb = new StringBuilder(envelopeEeceiverId.DecodeEnvelopeReceiverId().ToTitle());
|
|
|
|
if (message is not null)
|
|
sb.AppendLine().Append(message);
|
|
|
|
if(exception is null)
|
|
logger.Log(LogLevel.Error, sb.ToString(), args);
|
|
else
|
|
logger.Log(LogLevel.Error, exception, sb.ToString(), args);
|
|
}
|
|
|
|
public static void LogEnvelopeError(this ILogger logger, string? uuid, string? signature = null, Exception? exception = null, string? message = null, params object?[] args)
|
|
{
|
|
var sb = new StringBuilder($"Envelope Uuid: {uuid}");
|
|
|
|
if(signature is not null)
|
|
sb.AppendLine().Append($"Receiver Signature: {signature}");
|
|
|
|
if (message is not null)
|
|
sb.AppendLine().Append(message);
|
|
|
|
if (exception is null)
|
|
logger.Log(LogLevel.Error, sb.ToString(), args);
|
|
else
|
|
logger.Log(LogLevel.Error, exception, sb.ToString(), args);
|
|
}
|
|
|
|
public static string ToTitle(this (string? UUID, string? Signature) envelopeReceiverTuple)
|
|
{
|
|
return $"UUID is {envelopeReceiverTuple.UUID} and \n signature is {envelopeReceiverTuple.Signature}";
|
|
}
|
|
}
|
|
} |