extensions
extensions copied to clipboard
[API Proposal]: TagProvider but as an interface
Background and motivation
Right now, TagProvider (and LogProperties) are bound to the partial log method for the generator, but the type and the logger are not always available next to each other. Using an interface you can have deconstruction behavior inside some other lib as well.
API Proposal
interface ITagProvider {
void RecordTags(ITagCollector collector);
}
API Usage
[GenerateTagProvider]
partial class SomeObj;
[LoggerMessage(...)]
private static partial void SomeLog(
this ILogger logger,
[LogProperties] ITagProvider obj);
Alternative Designs
Using an interceptor like https://github.com/dotnet/runtime/issues/102633 could perhaps help here, but that in and by itself won't cover the generic case without some sort of interfacing.
Risks
No response