mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
General - Log fatal exceptions on all platforms
This commit is contained in:
parent
b875e3d366
commit
021f17aef4
@ -17,6 +17,7 @@ namespace Artemis.UI.Linux
|
|||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
_kernel = ArtemisBootstrapper.Bootstrap(this);
|
_kernel = ArtemisBootstrapper.Bootstrap(this);
|
||||||
|
Program.CreateLogger(_kernel);
|
||||||
RxApp.MainThreadScheduler = AvaloniaScheduler.Instance;
|
RxApp.MainThreadScheduler = AvaloniaScheduler.Instance;
|
||||||
AvaloniaXamlLoader.Load(this);
|
AvaloniaXamlLoader.Load(this);
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.ReactiveUI;
|
using Avalonia.ReactiveUI;
|
||||||
|
using Ninject;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
namespace Artemis.UI.Linux
|
namespace Artemis.UI.Linux
|
||||||
{
|
{
|
||||||
@ -12,7 +14,15 @@ namespace Artemis.UI.Linux
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
|
try
|
||||||
|
{
|
||||||
|
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger?.Fatal(e, "Fatal exception, shutting down");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Avalonia configuration, don't remove; also used by visual designer.
|
// Avalonia configuration, don't remove; also used by visual designer.
|
||||||
@ -20,5 +30,12 @@ namespace Artemis.UI.Linux
|
|||||||
{
|
{
|
||||||
return AppBuilder.Configure<App>().UsePlatformDetect().LogToTrace().UseReactiveUI();
|
return AppBuilder.Configure<App>().UsePlatformDetect().LogToTrace().UseReactiveUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ILogger? Logger { get; set; }
|
||||||
|
|
||||||
|
public static void CreateLogger(IKernel kernel)
|
||||||
|
{
|
||||||
|
Logger = kernel.Get<ILogger>().ForContext<Program>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,15 +1,19 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
|
using Ninject;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
|
|
||||||
namespace Artemis.UI.MacOS
|
namespace Artemis.UI.MacOS
|
||||||
{
|
{
|
||||||
public class App : Application
|
public class App : Application
|
||||||
{
|
{
|
||||||
|
private StandardKernel? _kernel;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
ArtemisBootstrapper.Bootstrap(this);
|
_kernel = ArtemisBootstrapper.Bootstrap(this);
|
||||||
|
Program.CreateLogger(_kernel);
|
||||||
RxApp.MainThreadScheduler = AvaloniaScheduler.Instance;
|
RxApp.MainThreadScheduler = AvaloniaScheduler.Instance;
|
||||||
AvaloniaXamlLoader.Load(this);
|
AvaloniaXamlLoader.Load(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.ReactiveUI;
|
using Avalonia.ReactiveUI;
|
||||||
|
using Ninject;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
namespace Artemis.UI.MacOS
|
namespace Artemis.UI.MacOS
|
||||||
{
|
{
|
||||||
@ -12,7 +14,15 @@ namespace Artemis.UI.MacOS
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
|
try
|
||||||
|
{
|
||||||
|
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger?.Fatal(e, "Fatal exception, shutting down");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Avalonia configuration, don't remove; also used by visual designer.
|
// Avalonia configuration, don't remove; also used by visual designer.
|
||||||
@ -20,5 +30,12 @@ namespace Artemis.UI.MacOS
|
|||||||
{
|
{
|
||||||
return AppBuilder.Configure<App>().UsePlatformDetect().LogToTrace().UseReactiveUI();
|
return AppBuilder.Configure<App>().UsePlatformDetect().LogToTrace().UseReactiveUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ILogger? Logger { get; set; }
|
||||||
|
|
||||||
|
public static void CreateLogger(IKernel kernel)
|
||||||
|
{
|
||||||
|
Logger = kernel.Get<ILogger>().ForContext<Program>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -37,9 +37,9 @@ namespace Artemis.UI.Windows
|
|||||||
inputService.AddInputProvider(standardKernel.Get<WindowsInputProvider>());
|
inputService.AddInputProvider(standardKernel.Get<WindowsInputProvider>());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReSharper disable NotAccessedField.Local
|
|
||||||
private StandardKernel? _kernel;
|
private StandardKernel? _kernel;
|
||||||
|
|
||||||
|
// ReSharper disable NotAccessedField.Local
|
||||||
private ApplicationStateManager? _applicationStateManager;
|
private ApplicationStateManager? _applicationStateManager;
|
||||||
// ReSharper restore NotAccessedField.Local
|
// ReSharper restore NotAccessedField.Local
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user