From 227e68f8fd53cc3346e5d581b06ed4e0246b330f Mon Sep 17 00:00:00 2001 From: "waffle.lord" Date: Tue, 5 Sep 2023 20:23:28 -0400 Subject: [PATCH] move logger config to app init --- SPTInstaller/App.axaml.cs | 10 ++++++++++ SPTInstaller/Program.cs | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/SPTInstaller/App.axaml.cs b/SPTInstaller/App.axaml.cs index 6f10e85..4c11cef 100644 --- a/SPTInstaller/App.axaml.cs +++ b/SPTInstaller/App.axaml.cs @@ -15,6 +15,16 @@ public partial class App : Application { AvaloniaXamlLoader.Load(this); + var logPath = Path.Join(Environment.CurrentDirectory, "spt-aki-installer_.log"); + + Log.Logger = new LoggerConfiguration() + .MinimumLevel.Debug() + .WriteTo + .File(path: logPath, + restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Debug, + rollingInterval: RollingInterval.Day) + .CreateLogger(); + RxApp.DefaultExceptionHandler = Observer.Create((exception) => { Log.Error(exception, "An application exception occurred"); diff --git a/SPTInstaller/Program.cs b/SPTInstaller/Program.cs index 019fd25..8b99ec6 100644 --- a/SPTInstaller/Program.cs +++ b/SPTInstaller/Program.cs @@ -1,7 +1,6 @@ using Avalonia; using Avalonia.ReactiveUI; using ReactiveUI; -using Serilog; using Splat; using SPTInstaller.Controllers; using SPTInstaller.Helpers; @@ -37,15 +36,6 @@ internal class Program ServiceHelper.Register(); ServiceHelper.Register(); - var logPath = Path.Join(Environment.CurrentDirectory, "spt-aki-installer_.log"); - - Log.Logger = new LoggerConfiguration() - .MinimumLevel.Debug() - .WriteTo - .File(path: logPath, - restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Debug, - rollingInterval: RollingInterval.Day) - .CreateLogger(); ServiceHelper.Register(); ServiceHelper.Register();