1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Added logging on fatal crashes

Moved logs to a seperate Logs folder
This commit is contained in:
Robert 2019-11-05 20:25:13 +01:00
parent 7de98fd02b
commit d0e369c653
6 changed files with 17 additions and 2 deletions

View File

@ -8,7 +8,7 @@ namespace Artemis.Core.Ninject
private static readonly ILogger _logger = new LoggerConfiguration()
.Enrich.FromLogContext()
.Enrich.WithDemystifiedStackTraces()
.WriteTo.File("Artemis log-.txt",
.WriteTo.File("Logs/Artemis log-.txt",
rollingInterval: RollingInterval.Day,
outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] [{SourceContext:l}] {Message:lj}{NewLine}{Exception}")
.CreateLogger();

View File

@ -94,6 +94,7 @@ namespace Artemis.Core.Services
private void SurfaceOnException(ExceptionEventArgs args)
{
_logger.Warning("Surface threw e");
throw args.Exception;
}

View File

@ -87,6 +87,7 @@
<Reference Include="MaterialDesignThemes.Wpf, Version=2.6.0.325, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialDesignThemes.2.6.0\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Data.Sqlite, Version=2.2.4.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Data.Sqlite.Core.2.2.4\lib\netstandard2.0\Microsoft.Data.Sqlite.dll</HintPath>
</Reference>
@ -110,6 +111,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\RGB.NET\bin\net45\RGB.NET.Groups.dll</HintPath>
</Reference>
<Reference Include="Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>..\packages\Serilog.2.8.0\lib\net46\Serilog.dll</HintPath>
</Reference>
<Reference Include="SQLitePCLRaw.batteries_green, Version=1.1.12.351, Culture=neutral, PublicKeyToken=a84b7dcfb1391f7f, processorArchitecture=MSIL">
<HintPath>..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_green.dll</HintPath>
</Reference>

View File

@ -3,7 +3,6 @@ using Artemis.Core.Ninject;
using Artemis.Core.Services.Interfaces;
using Artemis.UI.Ninject;
using Artemis.UI.Stylet;
using Artemis.UI.ViewModels;
using Artemis.UI.ViewModels.Screens;
using Ninject;

View File

@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Windows.Threading;
using Ninject;
using Serilog;
using Stylet;
namespace Artemis.UI.Stylet
@ -63,5 +65,13 @@ namespace Artemis.UI.Stylet
if (Kernel != null)
Kernel.Dispose();
}
protected override void OnUnhandledException(DispatcherUnhandledExceptionEventArgs e)
{
var logger = Kernel.Get<ILogger>();
logger.Fatal(e.Exception, "Fatal exception, shutting down.");
base.OnUnhandledException(e);
}
}
}

View File

@ -15,6 +15,7 @@
<package id="Ninject.Extensions.Conventions" version="3.3.0" targetFramework="net461" />
<package id="Ninject.Extensions.Factory" version="3.3.2" targetFramework="net461" />
<package id="PropertyChanged.Fody" version="3.0.1" targetFramework="net472" />
<package id="Serilog" version="2.8.0" targetFramework="net472" />
<package id="SQLitePCLRaw.bundle_green" version="1.1.12" targetFramework="net472" />
<package id="SQLitePCLRaw.core" version="1.1.12" targetFramework="net472" />
<package id="SQLitePCLRaw.lib.e_sqlite3.linux" version="1.1.12" targetFramework="net472" />