Improve verbosity of logs

This commit is contained in:
Jeddunk 2021-04-07 13:52:56 +02:00
parent 8e62880e23
commit 653e97beab

View File

@ -193,10 +193,10 @@ namespace GoldbergGUI.Core.Services
public async Task<List<SteamApp>> GetListOfDlc(SteamApp steamApp, bool useSteamDb) public async Task<List<SteamApp>> GetListOfDlc(SteamApp steamApp, bool useSteamDb)
{ {
_log.Info("Get DLC");
var dlcList = new List<SteamApp>(); var dlcList = new List<SteamApp>();
if (steamApp != null) if (steamApp != null)
{ {
_log.Info($"Get DLC for App {steamApp}");
var task = AppDetails.GetAsync(steamApp.AppId); var task = AppDetails.GetAsync(steamApp.AppId);
var steamAppDetails = await task.ConfigureAwait(true); var steamAppDetails = await task.ConfigureAwait(true);
if (steamAppDetails.Type == AppType.Game.Value) if (steamAppDetails.Type == AppType.Game.Value)
@ -216,9 +216,9 @@ namespace GoldbergGUI.Core.Services
// Scrape and parse HTML page // Scrape and parse HTML page
// Add missing to DLC list // Add missing to DLC list
// ReSharper disable once InvertIf // Return current list if we don't intend to use SteamDB
if (useSteamDb) if (!useSteamDb) return dlcList;
{
try try
{ {
var steamDbUri = new Uri($"https://steamdb.info/app/{steamApp.AppId}/dlc/"); var steamDbUri = new Uri($"https://steamdb.info/app/{steamApp.AppId}/dlc/");
@ -226,7 +226,7 @@ namespace GoldbergGUI.Core.Services
var client = new HttpClient(); var client = new HttpClient();
client.DefaultRequestHeaders.UserAgent.ParseAdd(UserAgent); client.DefaultRequestHeaders.UserAgent.ParseAdd(UserAgent);
_log.Info("Get SteamDB App"); _log.Info($"Get SteamDB App {steamApp}");
var httpCall = client.GetAsync(steamDbUri); var httpCall = client.GetAsync(steamDbUri);
var response = await httpCall.ConfigureAwait(false); var response = await httpCall.ConfigureAwait(false);
_log.Debug(httpCall.Status.ToString()); _log.Debug(httpCall.Status.ToString());
@ -242,6 +242,7 @@ namespace GoldbergGUI.Core.Services
var query1 = doc.QuerySelector("#dlc"); var query1 = doc.QuerySelector("#dlc");
if (query1 != null) if (query1 != null)
{ {
_log.Info("Got list of DLC from SteamDB.");
var query2 = query1.QuerySelectorAll(".app"); var query2 = query1.QuerySelectorAll(".app");
foreach (var element in query2) foreach (var element in query2)
{ {
@ -272,11 +273,10 @@ namespace GoldbergGUI.Core.Services
} }
catch (Exception e) catch (Exception e)
{ {
_log.Error("Could not get DLC from SteamDB!"); _log.Error("Could not get DLC from SteamDB! Skipping...");
_log.Error(e.ToString); _log.Error(e.ToString);
} }
} }
}
else else
{ {
_log.Error("Could not get DLC: Steam App is not of type \"game\""); _log.Error("Could not get DLC: Steam App is not of type \"game\"");