There are two distinct generated types for ILogger-based generation.
This is the default generation method when the Microsoft.Extensions.Telemetry.Abstractions
package is referenced either directly or in-directly.
The generated log implementations more closely resembles the output from the Microsoft.Gen.Logging
generator, but with a few additional features.
These include the ability to generate a MessageTemplate
dynamically, and enumerate a capture elements in an array/ IEnumerable
.
You can opt-out of this new type of generation by explicitly setting by setting LoggingAttribute.DisableMSLoggingTelemetryGeneration
to false
on your interface definition, or by setting LoggerGenerationAttribute.DisableMSLoggingTelemetryGeneration
to false
at the assembly level.
More details can be found in the Generation v2 page.
This is the default generation method when Microsoft.Extensions.Telemetry.Abstractions
package is not referenced, or when DisableMSLoggingTelemetryGeneration
is set to true true
on either LoggingAttribute
or LoggerGenerationAttribute
.
This type of generation utilises the older-style High-performance logging.
More details can be found in the Generation v1 page.
To disable logger-based generation in your project add a build constant to either you .csproj
or Directory.Build.props
with a value of EXCLUDE_PURVIEW_TELEMETRY_LOGGING
, and the logging attributes will be ignored.
<!-- In a .csproj --> <DefineConstants>EXCLUDE_PURVIEW_TELEMETRY_LOGGING</DefineConstants> <!-- In a Directory.Build.Props --> <PropertyGroup> <DefineConstants>EXCLUDE_PURVIEW_TELEMETRY_LOGGING</DefineConstants> </PropertyGroup>
This primarily used for when the Microsoft.Extensions.Logging.ILogger
type is unavailable. In this case your project will fail to compile due to the generated attributes using related types such as the LogLevel
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4