feat(FinishEnvelopeJob): enhance FinishEnvelopeJob logging for finalized envelopes

- Removed redundant initial info log.
- Added detailed logging after job execution:
  - Logs total finalized envelope count.
  - Logs UUIDs of finalized envelopes when available.
  - Logs success message when no envelopes were finalized.
This commit is contained in:
Developer 02 2025-11-06 09:59:16 +01:00
parent 567b9c9565
commit 05130d6163

View File

@ -25,10 +25,6 @@ namespace EnvelopeGenerator.Finalizer.Job
public async Task Execute(IJobExecutionContext context)
{
var cancel = context.CancellationToken;
if (_logger.IsEnabled(LogLevel.Information))
{
_logger.LogInformation("{jobName} running at: {time}", context.JobDetail.Key, DateTimeOffset.Now);
}
var envelopes = await _mediator.Send(new ReadEnvelopeQuery()
{
@ -40,6 +36,20 @@ namespace EnvelopeGenerator.Finalizer.Job
{
// add sub-steps
}
if (envelopes.Any())
_logger.LogInformation(
"Job '{JobName}' executed at {Timestamp}. {EnvelopeCount} envelope(s) successfully finalized. UUID(s): {EnvelopeUuids}",
context.JobDetail.Key.Name,
DateTimeOffset.Now,
envelopes.Count(),
string.Join(", ", envelopes.Select(e => e.Uuid))
);
else
_logger.LogInformation("Job '{JobName}' executed successfully at {Timestamp}. No envelopes were finalized.",
context.JobDetail.Key.Name,
DateTimeOffset.Now
);
}
}
}