Add Serilog

This commit is contained in:
ShabOl 2023-11-26 01:11:09 +04:00
parent d1e5715231
commit b1f9c38b44
2 changed files with 10 additions and 2 deletions

View File

@ -30,6 +30,9 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.5" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup>
<ItemGroup>

View File

@ -1,6 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using Serilog;
namespace AirBomber
{
@ -11,6 +11,11 @@ namespace AirBomber
{
ApplicationConfiguration.Initialize();
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.File("airbomberlog-.log", rollingInterval: RollingInterval.Day)
.CreateLogger();
var services = new ServiceCollection();
ConfigureServices(services);
@ -26,7 +31,7 @@ namespace AirBomber
option =>
{
option.SetMinimumLevel(LogLevel.Information);
option.AddNLog("nlog.config");
option.AddSerilog();
}
);
}