Author : MD TAREQ HASSAN | Updated : 2020/12/11
Pre-requisites
Dependency injection in console app
Qucik Logging Without DI
- Nuget:
Install-Package Microsoft.Extensions.Logging.Console
- Use:
ILogger logger = new LoggerFactory().CreateLogger<Foo>();
using Microsoft.Extensions.Logging;
namespace ConsoleApp.Logging
{
public class Foo
{
public static void Xxx()
{
ILogger logger = new LoggerFactory().CreateLogger<Functions>();
logger.LogInformation("Foo Bar Baz");
}
}
}