From 23459ec79463afe81675702aa4656ad354d668cd Mon Sep 17 00:00:00 2001 From: Jeddunk Date: Mon, 15 Feb 2021 16:51:50 +0100 Subject: [PATCH] Fixed exception throwing stuff idunno --- auto-creamapi/Services/CacheService.cs | 3 ++- auto-creamapi/Utils/MyLogger.cs | 2 ++ auto-creamapi/auto-creamapi.csproj | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/auto-creamapi/Services/CacheService.cs b/auto-creamapi/Services/CacheService.cs index 081c2c6..8d906a4 100644 --- a/auto-creamapi/Services/CacheService.cs +++ b/auto-creamapi/Services/CacheService.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; using System.Net.Http; @@ -211,7 +212,7 @@ namespace auto_creamapi.Services catch (Exception e) { MyLogger.Log.Error("Could not get DLC!"); - Console.WriteLine(e); + MyLogger.Log.Debug(e.Demystify(), "Exception thrown!"); } return dlcList; diff --git a/auto-creamapi/Utils/MyLogger.cs b/auto-creamapi/Utils/MyLogger.cs index 9e1b19a..a35a873 100644 --- a/auto-creamapi/Utils/MyLogger.cs +++ b/auto-creamapi/Utils/MyLogger.cs @@ -1,5 +1,6 @@ using Serilog; using Serilog.Core; +using Serilog.Exceptions; namespace auto_creamapi.Utils { @@ -7,6 +8,7 @@ namespace auto_creamapi.Utils { public static readonly Logger Log = new LoggerConfiguration() .MinimumLevel.Debug() + .Enrich.WithExceptionDetails() .WriteTo.Console() .WriteTo.File("autocreamapi.log", rollingInterval: RollingInterval.Day) .CreateLogger(); diff --git a/auto-creamapi/auto-creamapi.csproj b/auto-creamapi/auto-creamapi.csproj index 706b37f..38f78be 100644 --- a/auto-creamapi/auto-creamapi.csproj +++ b/auto-creamapi/auto-creamapi.csproj @@ -19,6 +19,7 @@ + @@ -27,6 +28,7 @@ +