Erdinc Yasan
Erdinc Yasan
CC#
Created by engineertdog on 2/23/2024 in #help
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
CC#
Created by engineertdog on 2/23/2024 in #help
C# 8 logging
A-) in your appsettings.json and appsettings.Development.json file , you can set DefaultLogging levels, when you write into it "None" it wont be log anything to console b-) yes you can move it to serilog c-) same as b
6 replies