Erdinc Yasan
C# 8 logging
Log.Logger = new LoggerConfiguration()
.WriteTo.Console(LogEventLevel.Information)
.CreateLogger();
builder.Logging.AddSerilog();
builder.Services.AddHostedService<Worker>();
you need to add this packages to your worker service
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
6 replies