GoldbergGUI/GoldbergGUI.WPF/Setup.cs
2022-05-12 21:40:39 +02:00

27 lines
811 B
C#

using Microsoft.Extensions.Logging;
using MvvmCross.Platforms.Wpf.Core;
using Serilog;
using Serilog.Extensions.Logging;
using System.IO;
namespace GoldbergGUI.WPF
{
public class Setup : MvxWpfSetup<Core.App>
{
protected override ILoggerProvider CreateLogProvider()
{
return new SerilogLoggerProvider();
}
protected override ILoggerFactory CreateLogFactory()
{
var logPath = Path.Combine(Directory.GetCurrentDirectory(), "goldberg_.log");
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Console()
.WriteTo.File(logPath, rollingInterval: RollingInterval.Day)
.CreateLogger();
return new SerilogLoggerFactory();
}
}
}