In .net 7 we had IHostBuilder and the following code was working using nuget package Serilog.AspNetCore
.UseSerilog((context, config) => config.ReadFrom.Configuration(context.Configuration))
In .net 8 we have HostApplicationBuilder. how would we use Serilog with auto generated template?
You have to use
HostApplicationBuilder.Servicesobject. Here is a code snippet to show you how to use SeriLog with .NET 8 worker service.