static void

ASP.Net Core Logging

See docs.asp.net

Nuget packages

Startup

Use

Unit Tests

In a test you will need to provide an ILogger<X>. Provide it with NullLogger<X>.Instance

var validator = new X(NullLogger<X>.Instance);

NLog

Sample NLog setup in .net 6 Program.cs

    public class Program
    {
        public static void Main(string[] args)
        {

            Trace.Listeners.Add(new NLogTraceListener());

            var builder = WebApplication.CreateBuilder(args);


            // NLog: Setup NLog for Dependency injection
            builder.Logging.ClearProviders();
            builder.Host.UseNLog();

            builder.Services.AddControllers();