diff --git a/Filtration/Filtration.csproj b/Filtration/Filtration.csproj index c23e09c..65ed30d 100644 --- a/Filtration/Filtration.csproj +++ b/Filtration/Filtration.csproj @@ -230,6 +230,7 @@ ThemeComponentSelectionControl.xaml + diff --git a/Filtration/Filtration.nuspec b/Filtration/Filtration.nuspec index 40eccf3..f679557 100644 --- a/Filtration/Filtration.nuspec +++ b/Filtration/Filtration.nuspec @@ -10,7 +10,8 @@ false Copyright 2018 * Added missing AlertSound mp3 resources to installer -* Fixed a crash related to performing certain commands with no blocks selected +* Fixed a crash related to performing certain commands with no blocks selected +* Added extra logging to updater diff --git a/Filtration/NLog.config b/Filtration/NLog.config index af4b9bb..00cf2ac 100644 --- a/Filtration/NLog.config +++ b/Filtration/NLog.config @@ -10,15 +10,21 @@ layout="${longdate} ${uppercase:${level}} ${message}" /> + + + + + \ No newline at end of file diff --git a/Filtration/Properties/AssemblyInfo.cs b/Filtration/Properties/AssemblyInfo.cs index bf5655f..d79c7e3 100644 --- a/Filtration/Properties/AssemblyInfo.cs +++ b/Filtration/Properties/AssemblyInfo.cs @@ -11,7 +11,7 @@ using System.Runtime.CompilerServices; [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("1.0.3")] -[assembly: AssemblyInformationalVersion("1.0.3-beta2")] +[assembly: AssemblyInformationalVersion("1.0.3-beta3")] [assembly: InternalsVisibleTo("Filtration.Tests")] [assembly: InternalsVisibleTo("Filtration.ItemFilterPreview.Tests")] diff --git a/Filtration/Services/UpdateService.cs b/Filtration/Services/UpdateService.cs index 120f628..7b3c778 100644 --- a/Filtration/Services/UpdateService.cs +++ b/Filtration/Services/UpdateService.cs @@ -4,6 +4,7 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; using Filtration.Enums; using Filtration.Properties; +using Filtration.Utility; using NLog; using Squirrel; @@ -76,11 +77,14 @@ namespace Filtration.Services private bool _downloadPrereleaseUpdates; private UpdateStatus _updateStatus; - public UpdateService(ISettingsService settingsService) + public UpdateService(ISettingsService settingsService, + ISplatNLogAdapter splatNLogAdapter) { _settingsService = settingsService; UpdateStatus = UpdateStatus.NoUpdateAvailable; + + Splat.Locator.CurrentMutable.Register(() => splatNLogAdapter, typeof(Splat.ILogger)); } public event EventHandler UpdateStatusChanged; diff --git a/Filtration/Utility/SplatNLogAdapter.cs b/Filtration/Utility/SplatNLogAdapter.cs new file mode 100644 index 0000000..59916c2 --- /dev/null +++ b/Filtration/Utility/SplatNLogAdapter.cs @@ -0,0 +1,52 @@ +using System; +using NLog; +using ILogger = Splat.ILogger; +using LogLevel = Splat.LogLevel; + +namespace Filtration.Utility +{ + public interface ISplatNLogAdapter + { + } + + public class SplatNLogAdapter : ILogger, ISplatNLogAdapter + { + private static readonly Logger Logger = LogManager.GetLogger("SquirrelLogger"); + + public void Write(string message, LogLevel logLevel) + { + switch (logLevel) + { + case LogLevel.Debug: + { + Logger.Debug(message); + break; + } + case LogLevel.Info: + { + Logger.Info(message); + break; + } + case LogLevel.Error: + { + Logger.Error(message); + break; + } + case LogLevel.Fatal: + { + Logger.Fatal(message); + break; + } + case LogLevel.Warn: + { + Logger.Warn(message); + break; + } + default: + throw new ArgumentOutOfRangeException(nameof(logLevel), logLevel, null); + } + } + + public LogLevel Level { get; set; } + } +} diff --git a/Filtration/WindsorInstallers/ServicesInstaller.cs b/Filtration/WindsorInstallers/ServicesInstaller.cs index f736c1e..141c089 100644 --- a/Filtration/WindsorInstallers/ServicesInstaller.cs +++ b/Filtration/WindsorInstallers/ServicesInstaller.cs @@ -2,6 +2,7 @@ using Castle.MicroKernel.SubSystems.Configuration; using Castle.Windsor; using Filtration.Services; +using Filtration.Utility; namespace Filtration.WindsorInstallers { @@ -43,6 +44,11 @@ namespace Filtration.WindsorInstallers Component.For() .ImplementedBy() .LifeStyle.Singleton); + + container.Register( + Component.For() + .ImplementedBy() + .LifeStyle.Singleton); } } }