From 1b99435562729b9eec71c1ae31fa3cc4de75296a Mon Sep 17 00:00:00 2001 From: Christiaan Bloemendaal Date: Tue, 27 Feb 2024 21:46:20 +0100 Subject: [PATCH] feat: logging --- CalculatePlayerPointsJob.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CalculatePlayerPointsJob.cs b/CalculatePlayerPointsJob.cs index 968d6f4..6d7f92c 100644 --- a/CalculatePlayerPointsJob.cs +++ b/CalculatePlayerPointsJob.cs @@ -22,10 +22,12 @@ public class CalculatePlayerPointsJob : IJob }; private readonly GTRContext db; + private readonly ILogger _logger; - public CalculatePlayerPointsJob(GTRContext db) + public CalculatePlayerPointsJob(GTRContext db, ILogger logger) { this.db = db; + _logger = logger; } public async Task Execute(IJobExecutionContext context) @@ -94,6 +96,7 @@ public async Task Execute(IJobExecutionContext context) } } - await db.SaveChangesAsync(context.CancellationToken); + int saveChangesAsync = await db.SaveChangesAsync(context.CancellationToken); + _logger.LogInformation("Saved {Count} changes", saveChangesAsync); } }