-
Notifications
You must be signed in to change notification settings - Fork 29
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
Support for Microsoft.Extensions.Logging #15
Comments
I'm not very familiar with |
Alongside this, adding support for NLog (4.5+) would also be interesting to discuss. Just remembered about this issue while reading NLog/NLog.StructuredEvents#46. (CC @304NotModified.) |
Also- LibLog, which supports message template syntax too. |
It seems like there are analyzers for And they will be shipped in Core 2.2 |
I implemented a plugin for R# and Rider which highlights templates for Serilog, NLog, and Microsoft.Extensions.Logging, at the moment it doesn't have some analyzers and code fixes. |
What would it take to have this added? I saw reference to expanding a whitelist, is that all it would take? The project I'm working on takes ILogger instances as constructor parameters and logs through those and this extension doesn't seem to recognize them. |
I did some local digging. So far I've removed/disabled the code below because Serilog itself doesn't show up in the sub projects because they only rely on ILogger from Microsoft.Extensions.Logging
I changed the method attributes check to
I changed the code that looks for the template parameter to check by parameter name instead of an attribute
It's all ugly bodge work but I get analysis messages now and nothing has crashed yet. |
Thx for the reply and the Info to #52.
From my experience - examples: Serilog: Log.Information("Template {Var}",var) (I think a reference to a static Object) Mircrosoft: logger.LogInformation("Template {Var}",var) (Referece to a DI injected Object IIogger with for shure different names in each project / solution) I do not know how VS extensions work, but I believe that parsing the template is exactly the same. |
about this, it hasn't been shipped yet: dotnet/extensions#3434 |
Please add analysis of ILogger messages from Microsoft.Extensions.Logging.
E.g. I'm using Serilog with Microsoft.Extensions.Logging, but log messages with interpolation are not highlighted correctly.
Inspections should run if both MS Logging extensions and Serilog are referenced or it can be controlled by some configuration option.
Thanks
The text was updated successfully, but these errors were encountered: