Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analysis not performed when Serilog is used indirectly #43

Open
srogovtsev opened this issue Apr 2, 2019 · 1 comment
Open

Analysis not performed when Serilog is used indirectly #43

srogovtsev opened this issue Apr 2, 2019 · 1 comment

Comments

@srogovtsev
Copy link

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.

@JinsPeter
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants