Click or drag to resize

ConfigSettingLayoutRenderer Class

Layout renderer that can lookup values from Microsoft Extension Configuration Container (json, xml, ini)
Inheritance Hierarchy
SystemObject
  NLog.LayoutRenderersLayoutRenderer
    NLog.Extensions.LoggingConfigSettingLayoutRenderer

Namespace:  NLog.Extensions.Logging
Assembly:  NLog.Extensions.Logging (in NLog.Extensions.Logging.dll) Version: 5.3.13+9106fa3b6a3bdf3fbae3d40dbd52b6c23eb3b9f3
Syntax
public class ConfigSettingLayoutRenderer : LayoutRenderer

The ConfigSettingLayoutRenderer type exposes the following members.

Properties
  NameDescription
Protected propertyLoggingConfiguration
Gets the logging configuration this target is part of.
(Inherited from LayoutRenderer.)
Protected propertyValueFormatter
Value formatter
(Inherited from LayoutRenderer.)
Top
Methods
  NameDescription
Protected methodAppend
Renders the value of layout renderer in the context of the specified log event into StringBuilder.
(Inherited from LayoutRenderer.)
Protected methodCloseLayoutRenderer
Closes the layout renderer.
(Inherited from LayoutRenderer.)
Protected methodGetCulture
Get the CultureInfo for rendering the messages to a String
(Inherited from LayoutRenderer.)
Protected methodGetFormatProvider
Get the IFormatProvider for rendering the messages to a String
(Inherited from LayoutRenderer.)
Protected methodInitializeLayoutRenderer
Initializes the layout renderer.
(Inherited from LayoutRenderer.)
Public methodRender
Renders the value of layout renderer in the context of the specified log event.
(Inherited from LayoutRenderer.)
Protected methodResolveServiceT
Resolves the interface service-type from the service-repository
(Inherited from LayoutRenderer.)
Public methodToString
Returns a string that represents the current object.
(Inherited from LayoutRenderer.)
Top
Remarks
Not to be confused with NLog.AppConfig that includes ${appsetting}
Examples
Example: appsettings.json { "Mode":"Prod", "Options":{ "StorageConnectionString":"UseDevelopmentStorage=true", } } Config Setting Lookup: ${configsetting:name=Mode} = "Prod" ${configsetting:name=Options.StorageConnectionString} = "UseDevelopmentStorage=true" ${configsetting:name=Options.TableName:default=MyTable} = "MyTable" Config Setting Lookup Cached: ${configsetting:cached=True:name=Mode}
See Also