Configure the logger in the builder in the Program.Main configuration file. Add a package reference for Microsoft.Extensions.Logging.Configuration to the Blazor app’s project file using the NuGet package manager.
Now, add the namespace as Microsoft.Extensions.Logging to Program.cs and add the builder logging configuration. This configuration will prevent the logging info in the browser console.
[Program.cs]
using Microsoft.Extensions.Logging;
. . .
. . .
public class Program
{
public static async Task Main(string[] args)
{
. . .
. . .
Builder.Logging.AddConfiguration(builder.Configuration.GetSection("Logging"));
}
}
Refer to “Logging configuration” for more details.
Share with