Skip to content

Breaking Changes

Kieron Lanning edited this page Mar 21, 2025 · 6 revisions

Breaking Changes

v1 and v2 to v3

Logging Event Name Generation

A change was made to the available options and the default value, to better support the default means of generation used by the Microsoft Logging/ Telemetry source generators.

Previously, the default event name generated for the logging method also included a trimmed down version of the class name, and the method name combined.

For example:

[Logger]
interface IServiceTelemetry
{
    void LogAThing(int theThing);
}

Important

In v1 and v2, the default event name for LogAThing would have been Service.LogAThing. As of v3, the default has changed to LogAThing.

This is supported by the following changes to the LogPrefixType's field.

Field Old Behaviour New Behaviour
Default Generated a prefix based on the generated class name. Generates no suffix.
NoSuffix Generated no suffix. Field removed
TrimmedClassName Previously the default behaviour. New field, generates a suffix based on the generated class name.

To return to the previous behaviour, set one of the following:

  • LoggerGenerationAttribute.DefaultPrefixType to LogPrefixType.TrimmedClassName at the assembly level.
  • LoggerAttribute.PrefixType to LogPrefixType.TrimmedClassName at the interface level.

Clone this wiki locally