Implemented Splat logging integration to enable Squirrel to write log files
This commit is contained in:
parent
4c826f42fd
commit
d4e8a72d47
|
@ -230,6 +230,7 @@
|
||||||
<Compile Include="UserControls\ThemeComponentSelectionControl.xaml.cs">
|
<Compile Include="UserControls\ThemeComponentSelectionControl.xaml.cs">
|
||||||
<DependentUpon>ThemeComponentSelectionControl.xaml</DependentUpon>
|
<DependentUpon>ThemeComponentSelectionControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Utility\SplatNLogAdapter.cs" />
|
||||||
<Compile Include="ViewModels\DesignTime\DesignTimeSettingsPageViewModel.cs" />
|
<Compile Include="ViewModels\DesignTime\DesignTimeSettingsPageViewModel.cs" />
|
||||||
<Compile Include="Views\AttachedProperties\SelectedItemsAttachedProperty.cs" />
|
<Compile Include="Views\AttachedProperties\SelectedItemsAttachedProperty.cs" />
|
||||||
<Compile Include="Utility\RoutedCommandHandler.cs" />
|
<Compile Include="Utility\RoutedCommandHandler.cs" />
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
<copyright>Copyright 2018</copyright>
|
<copyright>Copyright 2018</copyright>
|
||||||
<releaseNotes>* Added missing AlertSound mp3 resources to installer
|
<releaseNotes>* Added missing AlertSound mp3 resources to installer
|
||||||
* Fixed a crash related to performing certain commands with no blocks selected</releaseNotes>
|
* Fixed a crash related to performing certain commands with no blocks selected
|
||||||
|
* Added extra logging to updater</releaseNotes>
|
||||||
<dependencies />
|
<dependencies />
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
|
|
@ -10,15 +10,21 @@
|
||||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||||
<target xsi:type="File" name="fDebug" fileName="${basedir}/Filtration_debug_${shortdate}.log"
|
<target xsi:type="File" name="fDebug" fileName="${basedir}/Filtration_debug_${shortdate}.log"
|
||||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||||
|
<target xsi:type="File" name="fUpdater" fileName="${basedir}/Filtration_updater_${shortdate}.log"
|
||||||
|
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||||
<target xsi:type="Debugger" name="cDebug" layout="${longdate} ${uppercase:${level}} ${message}"/>
|
<target xsi:type="Debugger" name="cDebug" layout="${longdate} ${uppercase:${level}} ${message}"/>
|
||||||
</targets>
|
</targets>
|
||||||
|
|
||||||
<rules>
|
<rules>
|
||||||
|
|
||||||
|
<!-- Squirrel Updater Log-->
|
||||||
|
<logger name="SquirrelLogger" minlevel="Trace" writeTo="fUpdater" />
|
||||||
|
|
||||||
<!-- Uncomment the Debug line to enable Debug logging -->
|
<!-- Uncomment the Debug line to enable Debug logging -->
|
||||||
<!--<logger name="*" minlevel="Debug" writeTo="fDebug" final="true" />-->
|
<!--<logger name="*" minlevel="Debug" writeTo="fDebug" final="true" />-->
|
||||||
<logger name="*" minlevel="Error" writeTo="fErrors" />
|
<logger name="*" minlevel="Error" writeTo="fErrors" />
|
||||||
<logger name="*" minlevel="Trace" writeTo="cDebug" />
|
<logger name="*" minlevel="Trace" writeTo="cDebug" />
|
||||||
|
|
||||||
|
|
||||||
</rules>
|
</rules>
|
||||||
</nlog>
|
</nlog>
|
|
@ -11,7 +11,7 @@ using System.Runtime.CompilerServices;
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("1.0.3")]
|
[assembly: AssemblyVersion("1.0.3")]
|
||||||
[assembly: AssemblyInformationalVersion("1.0.3-beta2")]
|
[assembly: AssemblyInformationalVersion("1.0.3-beta3")]
|
||||||
|
|
||||||
[assembly: InternalsVisibleTo("Filtration.Tests")]
|
[assembly: InternalsVisibleTo("Filtration.Tests")]
|
||||||
[assembly: InternalsVisibleTo("Filtration.ItemFilterPreview.Tests")]
|
[assembly: InternalsVisibleTo("Filtration.ItemFilterPreview.Tests")]
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Filtration.Enums;
|
using Filtration.Enums;
|
||||||
using Filtration.Properties;
|
using Filtration.Properties;
|
||||||
|
using Filtration.Utility;
|
||||||
using NLog;
|
using NLog;
|
||||||
using Squirrel;
|
using Squirrel;
|
||||||
|
|
||||||
|
@ -76,11 +77,14 @@ namespace Filtration.Services
|
||||||
private bool _downloadPrereleaseUpdates;
|
private bool _downloadPrereleaseUpdates;
|
||||||
private UpdateStatus _updateStatus;
|
private UpdateStatus _updateStatus;
|
||||||
|
|
||||||
public UpdateService(ISettingsService settingsService)
|
public UpdateService(ISettingsService settingsService,
|
||||||
|
ISplatNLogAdapter splatNLogAdapter)
|
||||||
{
|
{
|
||||||
_settingsService = settingsService;
|
_settingsService = settingsService;
|
||||||
|
|
||||||
UpdateStatus = UpdateStatus.NoUpdateAvailable;
|
UpdateStatus = UpdateStatus.NoUpdateAvailable;
|
||||||
|
|
||||||
|
Splat.Locator.CurrentMutable.Register(() => splatNLogAdapter, typeof(Splat.ILogger));
|
||||||
}
|
}
|
||||||
|
|
||||||
public event EventHandler<UpdateStatusChangedEventArgs> UpdateStatusChanged;
|
public event EventHandler<UpdateStatusChangedEventArgs> UpdateStatusChanged;
|
||||||
|
|
|
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
using Castle.MicroKernel.SubSystems.Configuration;
|
using Castle.MicroKernel.SubSystems.Configuration;
|
||||||
using Castle.Windsor;
|
using Castle.Windsor;
|
||||||
using Filtration.Services;
|
using Filtration.Services;
|
||||||
|
using Filtration.Utility;
|
||||||
|
|
||||||
namespace Filtration.WindsorInstallers
|
namespace Filtration.WindsorInstallers
|
||||||
{
|
{
|
||||||
|
@ -43,6 +44,11 @@ namespace Filtration.WindsorInstallers
|
||||||
Component.For<ISettingsService>()
|
Component.For<ISettingsService>()
|
||||||
.ImplementedBy<SettingsService>()
|
.ImplementedBy<SettingsService>()
|
||||||
.LifeStyle.Singleton);
|
.LifeStyle.Singleton);
|
||||||
|
|
||||||
|
container.Register(
|
||||||
|
Component.For<ISplatNLogAdapter>()
|
||||||
|
.ImplementedBy<SplatNLogAdapter>()
|
||||||
|
.LifeStyle.Singleton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue