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: 6.0.0+b2556d03163fe4c7b4484f0ca757e7ee6f8c5e4e
Syntax
public class ConfigSettingLayoutRenderer : LayoutRenderer

The ConfigSettingLayoutRenderer type exposes the following members.

Constructors
  NameDescription
Public methodConfigSettingLayoutRenderer
Initializes a new instance of the ConfigSettingLayoutRenderer class
Top
Properties
  NameDescription
Public propertyDefault
The default value to render if the setting value is null.
Public propertyStatic memberDefaultConfiguration
Global Configuration Container
Public propertyItem
Item in the setting container
Protected propertyLoggingConfiguration
Gets the logging configuration this target is part of.
(Inherited from LayoutRenderer.)
Public propertyName Obsolete.
Name of the Item
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.
(Overrides LayoutRendererAppend(StringBuilder, LogEventInfo).)
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.
(Overrides LayoutRendererInitializeLayoutRenderer.)
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