| AspNetExtensionsAddNLog Method (ILoggingBuilder, FuncIServiceProvider, LogFactory) |
Enable NLog as logging provider for Microsoft Extension Logging, and provide isolated LogFactory
Namespace:
NLog.Web
Assembly:
NLog.Web.AspNetCore (in NLog.Web.AspNetCore.dll) Version: 5.3.13+628b0876960af3ee3454c99b7985dbb5e1c46bf0
Syntax public static ILoggingBuilder AddNLog(
this ILoggingBuilder builder,
Func<IServiceProvider, LogFactory> factoryBuilder
)
<ExtensionAttribute>
Public Shared Function AddNLog (
builder As ILoggingBuilder,
factoryBuilder As Func(Of IServiceProvider, LogFactory)
) As ILoggingBuilder
Dim builder As ILoggingBuilder
Dim factoryBuilder As Func(Of IServiceProvider, LogFactory)
Dim returnValue As ILoggingBuilder
returnValue = builder.AddNLog(factoryBuilder)
[<ExtensionAttribute>]
static member AddNLog :
builder : ILoggingBuilder *
factoryBuilder : Func<IServiceProvider, LogFactory> -> ILoggingBuilder
Parameters
- builder
- Type: ILoggingBuilder
- factoryBuilder
- Type: SystemFuncIServiceProvider, LogFactory
Initialize NLog LogFactory with NLog LoggingConfiguration.
Return Value
Type:
ILoggingBuilderUsage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
ILoggingBuilder. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Remarks Recommended to use AddNLogWeb() to avoid name-collission issue with NLog.Extension.Logging namespace
See Also