From b66632f930df18a857e46fee51f11d8f6bf239c7 Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Tue, 2 May 2023 17:01:12 -0600 Subject: [PATCH] Log tar log loading --- Wabbajack.Server/DataModels/TarLog.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Wabbajack.Server/DataModels/TarLog.cs b/Wabbajack.Server/DataModels/TarLog.cs index 7bc3b4b5..b306e8b8 100644 --- a/Wabbajack.Server/DataModels/TarLog.cs +++ b/Wabbajack.Server/DataModels/TarLog.cs @@ -1,3 +1,4 @@ +using Microsoft.Extensions.Logging; using Wabbajack.BuildServer; using Wabbajack.Paths; using Wabbajack.Paths.IO; @@ -8,10 +9,12 @@ public class TarLog { private Task> _tarKeys; private readonly AppSettings _settings; + private readonly ILogger _logger; - public TarLog(AppSettings settings) + public TarLog(AppSettings settings, ILogger logger) { _settings = settings; + _logger = logger; Load(); } @@ -19,15 +22,21 @@ public class TarLog { if (_settings.TarKeyFile.ToAbsolutePath().FileExists()) { - _tarKeys = Task.Run(async () => await _settings.TarKeyFile.ToAbsolutePath() - .ReadAllLinesAsync() - .Select(line => line.Trim()) - .ToHashSetAsync()); + _tarKeys = Task.Run(async () => + { + var keys = await _settings.TarKeyFile.ToAbsolutePath() + .ReadAllLinesAsync() + .Select(line => line.Trim()) + .ToHashSetAsync(); + _logger.LogInformation("Loaded {Count} tar keys", keys.Count); + return keys; + }); } else { _tarKeys = Task.Run(async () => new HashSet()); } + } public async Task Contains(string metricsKey)