ILogger in a Console Application

You need the following in your nuget packages:

Microsoft.Extensions.Logging
Microsoft.Extensions.Logging.Console

Once you have these two beauties, using an ILogger is easy:

ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddConsole());
ILogger log = loggerFactory.CreateLogger<Program>();

ILogger (last edited 2022-08-12 02:49:40 by scot)