You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a quite complicated framework that uses Serilog for logging internally, but exposes the same functionality via wrapper methods. We have wrapper methods decorated with MessageTemplateFormatMethod and initially every diagnostic worked - within the core framework assemblies.
When we started adding the package to the consumer assemblies, the diagnostics were not shown. A short investigation has shown us that it happens because the consumer assemblies do not reference Serilog, so this code shorts out:
var messageTemplateAttribute = context.SemanticModel.Compilation.GetTypeByMetadataName("Serilog.Core.MessageTemplateFormatMethodAttribute");
if (messageTemplateAttribute == null)
{
return;
}
So, the question is: is there any way to enable the diagnostics for the consumer assemblies without having them reference Serilog directly? As soon as we add the reference, everything works, but we would like to avoid that.
The text was updated successfully, but these errors were encountered:
We are also interested in the same. This is causing us to more difficulty sharing packages as SerilogAnalyser require specific attribute from Serilog.Core
Is there any way to avoid the requirement of Serilog.Core.MessageTemplateFormatMethodAttribute and allow a custom attribute for the purpose?
We have a quite complicated framework that uses Serilog for logging internally, but exposes the same functionality via wrapper methods. We have wrapper methods decorated with
MessageTemplateFormatMethod
and initially every diagnostic worked - within the core framework assemblies.When we started adding the package to the consumer assemblies, the diagnostics were not shown. A short investigation has shown us that it happens because the consumer assemblies do not reference Serilog, so this code shorts out:
So, the question is: is there any way to enable the diagnostics for the consumer assemblies without having them reference Serilog directly? As soon as we add the reference, everything works, but we would like to avoid that.
The text was updated successfully, but these errors were encountered: