 | SetupExtensionsBuilderExtensionsRegisterLayoutRenderer Method (ISetupExtensionsBuilder, String, FuncLogEventInfo, Object, LayoutRenderOptions) |
Register a custom NLog LayoutRenderer with a callback function layoutMethod. The callback receives the logEvent.
Namespace:
NLog
Assembly:
NLog (in NLog.dll) Version: 6.0.0+cfb73701cda54e2410b006f649f072e90daef707
Syntaxpublic static ISetupExtensionsBuilder RegisterLayoutRenderer(
this ISetupExtensionsBuilder setupBuilder,
string name,
Func<LogEventInfo, Object> layoutMethod,
LayoutRenderOptions options
)
<ExtensionAttribute>
Public Shared Function RegisterLayoutRenderer (
setupBuilder As ISetupExtensionsBuilder,
name As String,
layoutMethod As Func(Of LogEventInfo, Object),
options As LayoutRenderOptions
) As ISetupExtensionsBuilder
Dim setupBuilder As ISetupExtensionsBuilder
Dim name As String
Dim layoutMethod As Func(Of LogEventInfo, Object)
Dim options As LayoutRenderOptions
Dim returnValue As ISetupExtensionsBuilder
returnValue = setupBuilder.RegisterLayoutRenderer(name,
layoutMethod, options)
[<ExtensionAttribute>]
static member RegisterLayoutRenderer :
setupBuilder : ISetupExtensionsBuilder *
name : string *
layoutMethod : Func<LogEventInfo, Object> *
options : LayoutRenderOptions -> ISetupExtensionsBuilder
Parameters
- setupBuilder
- Type: NLog.ConfigISetupExtensionsBuilder
Fluent interface parameter. - name
- Type: SystemString
The layout-renderer type-alias for use in NLog configuration - without '${ }' - layoutMethod
- Type: SystemFuncLogEventInfo, Object
Callback that returns the value for the layout renderer. - options
- Type: NLog.LayoutsLayoutRenderOptions
Whether method is ThreadAgnostic and doesn't depend on context of the logging application thread.
Return Value
Type:
ISetupExtensionsBuilderUsage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
ISetupExtensionsBuilder. 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).
See Also