mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Log tar log loading
This commit is contained in:
parent
b0d3a4315f
commit
b66632f930
@ -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<HashSet<string>> _tarKeys;
|
||||
private readonly AppSettings _settings;
|
||||
private readonly ILogger<TarLog> _logger;
|
||||
|
||||
public TarLog(AppSettings settings)
|
||||
public TarLog(AppSettings settings, ILogger<TarLog> 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()
|
||||
_tarKeys = Task.Run(async () =>
|
||||
{
|
||||
var keys = await _settings.TarKeyFile.ToAbsolutePath()
|
||||
.ReadAllLinesAsync()
|
||||
.Select(line => line.Trim())
|
||||
.ToHashSetAsync());
|
||||
.ToHashSetAsync();
|
||||
_logger.LogInformation("Loaded {Count} tar keys", keys.Count);
|
||||
return keys;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
_tarKeys = Task.Run(async () => new HashSet<string>());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task<bool> Contains(string metricsKey)
|
||||
|
Loading…
Reference in New Issue
Block a user