Click or drag to resize

JsonLayout Class

A specialized layout that renders JSON-formatted events.
Inheritance Hierarchy
SystemObject
  NLog.LayoutsLayout
    NLog.LayoutsJsonLayout
      NLog.Extensions.LoggingMicrosoftConsoleJsonLayout

Namespace:  NLog.Layouts
Assembly:  NLog (in NLog.dll) Version: 5.3.4+73d83d3161d31288ca5c554cc50d27b6bed5f28b
Syntax
public class JsonLayout : Layout

The JsonLayout type exposes the following members.

Constructors
  NameDescription
Public methodJsonLayout
Initializes a new instance of the JsonLayout class.
Top
Properties
  NameDescription
Public propertyAttributes
Gets the array of attributes' configurations.
Public propertyEscapeForwardSlash
Should forward slashes be escaped? If true, / will be converted to \/
Public propertyExcludeEmptyProperties
Gets or sets the option to exclude null/empty properties from the log event (as JSON)
Public propertyExcludeProperties
List of property names to exclude when IncludeAllProperties is true
Public propertyIncludeEventProperties
Gets or sets the option to include all properties from the log event (as JSON)
Public propertyIncludeGdc
Gets or sets a value indicating whether to include contents of the GlobalDiagnosticsContext dictionary.
Public propertyIncludeScopeProperties
Gets or sets whether to include the contents of the ScopeContext dictionary.
Public propertyIndentJson
Auto indent and create new lines
Protected propertyLoggingConfiguration
Gets the logging configuration this target is part of.
(Inherited from Layout.)
Public propertyMaxRecursionLimit
How far should the JSON serializer follow object references before backing off
Public propertyRenderEmptyObject
Gets or sets the option to render the empty object value {}
Public propertySuppressSpaces
Gets or sets the option to suppress the extra spaces in the output json
Top
Methods
  NameDescription
Protected methodCloseLayout
Closes the layout.
(Overrides LayoutCloseLayout.)
Protected methodGetFormattedMessage
Renders formatted output using the log event as context.
(Overrides LayoutGetFormattedMessage(LogEventInfo).)
Protected methodInitializeLayout
Initializes the layout.
(Overrides LayoutInitializeLayout.)
Public methodPrecalculate
Precalculates the layout for the specified log event and stores the result in per-log event cache. Only if the layout doesn't have [ThreadAgnostic] and doesn't contain layouts with [ThreadAgnostic].
(Inherited from Layout.)
Public methodRender(LogEventInfo)
Renders formatted output using the log event as context.
(Inherited from Layout.)
Public methodRender(LogEventInfo, StringBuilder)
Optimized version of Render(LogEventInfo) that works best when override of RenderFormattedMessage(LogEventInfo, StringBuilder) is available.
(Inherited from Layout.)
Protected methodRenderFormattedMessage
Renders formatted output using the log event as context.
(Overrides LayoutRenderFormattedMessage(LogEventInfo, StringBuilder).)
Protected methodResolveServiceT
Resolve from DI ServiceRepository
(Inherited from Layout.)
Public methodToString
Returns a string that represents the current object.
(Overrides ObjectToString.)
Top
Remarks
See Also