NLog as Logging Provider for Microsoft Extension Logging
NLog.Extensions.Logging makes it possible to use NLog together with Microsoft ILogger-abstraction and Dependency Injection.
AddNLog()
extension methods to register NLog as LoggingProvider for Microsoft Extension Logging.Notice the standard NLog NuGet package is enough for using NLog Logger with simple console application on the .NET Core platform.
Just add NLog.config
file to the project, and follow the tutorial for using GetCurrentClassLogger()
.
NLog.Extensions.Hosting only introduces UseNLog()
as extension-method for the IHostBuilder
.
Note if using ASP.NET Core then instead install NLog.Web.AspNetCore.