|
|
|
@ -1,4 +1,6 @@
|
|
|
|
|
using System.Windows; |
|
|
|
|
using System; |
|
|
|
|
using System.IO; |
|
|
|
|
using System.Windows; |
|
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
|
using NLog.Extensions.Logging; |
|
|
|
@ -9,6 +11,7 @@ using StabilityMatrix.Services;
|
|
|
|
|
using StabilityMatrix.ViewModels; |
|
|
|
|
using Wpf.Ui.Contracts; |
|
|
|
|
using Wpf.Ui.Services; |
|
|
|
|
using SetupBuilderExtensions = NLog.SetupBuilderExtensions; |
|
|
|
|
|
|
|
|
|
namespace StabilityMatrix |
|
|
|
|
{ |
|
|
|
@ -29,14 +32,21 @@ namespace StabilityMatrix
|
|
|
|
|
serviceCollection.AddSingleton<SettingsViewModel>(); |
|
|
|
|
serviceCollection.AddSingleton<LaunchViewModel>(); |
|
|
|
|
serviceCollection.AddSingleton<IContentDialogService, ContentDialogService>(); |
|
|
|
|
serviceCollection.AddSingleton<ISnackbarService, SnackbarService>(); |
|
|
|
|
serviceCollection.AddSingleton<ISettingsManager, SettingsManager>(); |
|
|
|
|
serviceCollection.AddRefitClient<IGithubApi>(); |
|
|
|
|
|
|
|
|
|
var logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log.txt"); |
|
|
|
|
var logConfig = new NLog.Config.LoggingConfiguration(); |
|
|
|
|
var fileTarget = new NLog.Targets.FileTarget("logfile") {FileName = logPath}; |
|
|
|
|
logConfig.AddRule(NLog.LogLevel.Trace, NLog.LogLevel.Fatal, fileTarget); |
|
|
|
|
NLog.LogManager.Configuration = logConfig; |
|
|
|
|
|
|
|
|
|
serviceCollection.AddLogging(log => |
|
|
|
|
{ |
|
|
|
|
log.ClearProviders(); |
|
|
|
|
log.SetMinimumLevel(LogLevel.Trace); |
|
|
|
|
log.AddNLog(); |
|
|
|
|
log.AddNLog(logConfig); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
var provider = serviceCollection.BuildServiceProvider(); |
|
|
|
|