Skip to content

olsh/resharper-structured-logging

Repository files navigation

ReSharper Structured Logging

Build status Quality Gate Status

An extension for ReSharper and Rider IDE that highlights structured logging templates and contains some useful analyzers

The highlighting is a built-in feature starting from R#/Rider 2021.2, but the extension still contains some useful analyzers that are not (yet) implemented by JetBrains team

At the moment it supports Serilog, NLog, and Microsoft.Extensions.Logging

Installation ReSharper

Look for Structured Logging in ReSharper -> Extension manager.
JetBrains Plugins Repository

Installation Rider

Look for Structured Logging in Settings -> Plugins -> Browse repositories.
JetBrains Plugins Repository

Highlighting

Highlighting

Analyzers

Turning Off Analyzers

Individual analyzers can be disabled as needed either through code comments or by adding a line to a project's .editorconfig file.

Turning Off Via Comments

The analyzer name can be used as-is in a ReSharper comment to disable an analyzer on a per-file or per-line basis. For example:

// ReSharper disable once TemplateIsNotCompileTimeConstantProblem

Turning Off Via .editorconfig

To disable an analyzer for an entire directory, you can add a line to a .editorconfig file (learn more). In this case, the analyzer name needs to be converted to snake_case, prefixed with resharper_ and suffixed with _highlighting. For example:

resharper_template_is_not_compile_time_constant_problem_highlighting = none

Credits

Inspired by SerilogAnalyzer