Skip to content

Configuration

Sviatoslav Bychkov edited this page Jul 12, 2026 · 3 revisions

Configuration

The source generator has a few configurable properties that control its behavior. These properties are passed as build configurations and modify the generated code in different ways..

Property Name Description DefaultValue
build_property.AutoLoggerMessageGenerator_GenerateInterceptorAttribute Specifies whether the interceptor attribute should be generated true
build_property.AutoLoggerMessageGenerator_GenerateSkipEnabledCheck Sets LogProperties.SkipEnabledCheck to true. Determines whether to skip the logging-enabled check before invoking the log method. true
build_property.AutoLoggerMessageGenerator_GenerateOmitReferenceName Sets LogProperties.OmitReferenceName to true. This indicates whether to prefix the name of the parameter or property to the generated name of each tag being logged. false
build_property.AutoLoggerMessageGenerator_GenerateSkipNullProperties Sets LogProperties.SkipNullProperties to true. Specifies whether null properties should be omitted from the log entries. false
build_property.AutoLoggerMessageGenerator_GenerateTransitive Sets LogProperties.Transitive to true. This indicates that each property of any complex objects are expanded individually. false
build_property.AutoLoggerMessageGenerator_DefaultEventId Specifies the numeric event ID to use as the default fallback when no event ID is provided. Hashed value
build_property.AutoLoggerMessageGenerator_DefaultEventId_Name Specifies the event ID name to use as the default fallback when no event ID name is provided. Name of the generated log method

To configure one of these properties in your project, add the following line to the .editorconfig file.

build_property.AutoLoggerMessageGenerator_GenerateInterceptorAttribute = true

or in your project configuration file (specific or global)

<PropertyGroup>
    ...
    <AutoLoggerMessageGenerator_GenerateInterceptorAttribute>true</AutoLoggerMessageGenerator_GenerateInterceptorAttribute>
</PropertyGroup>

Clone this wiki locally