Reputation: 269
I am trying to use NLog on my project and following these steps I wonder how I could define the NLog lines in my Program.cs because there are no Main() and CreateHostBuilder() for Blazor server side.
Hope anyone can point me to right direction.
Upvotes: 7
Views: 3306
Reputation: 269
Found it! It is
builder.Host.UseNLog();
Edited to add more samples:
builder.Logging.ClearProviders();
builder.Logging.SetMinimumLevel(LogLevel.Trace);
builder.Logging.AddNLog(new NLogProviderOptions {
CaptureMessageTemplates = true,
CaptureMessageProperties = true
});
builder.Host.UseNLog();
Upvotes: 10