Table of Contents

Class PropertyEnricher

Namespace
Serilog.Core.Enrichers
Assembly
Serilog.dll

Adds a new property enricher to the log event.

public class PropertyEnricher : ILogEventEnricher
Inheritance
PropertyEnricher
Implements
Inherited Members

Constructors

PropertyEnricher(string, object?, bool)

Create a new property enricher.

public PropertyEnricher(string name, object? value, bool destructureObjects = false)

Parameters

name string

The name of the property.

value object

The value of the property.

destructureObjects bool

If true, and the value is a non-primitive, non-array type, then the value will be converted to a structure; otherwise, unknown types will be converted to scalars, which are generally stored as strings.

Exceptions

ArgumentNullException

When name is

null
ArgumentException

When name is empty or only contains whitespace

Methods

Enrich(LogEvent, ILogEventPropertyFactory)

Enrich the log event.

public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)

Parameters

logEvent LogEvent

The log event to enrich.

propertyFactory ILogEventPropertyFactory

Factory for creating new properties to add to the event.

Exceptions

ArgumentNullException

When logEvent is

null
ArgumentNullException

When propertyFactory is

null