As my application supports some paranoid debug level (every data assignment, every step in the code is written to a log destination), my code is littered with logging calls in some methods, e.g.
logger.Log(LogLevel.Debug, 0, "Initializing i18n...");
Lang.Language = SystemInfo.Language;
Logger.Log(LogLevel.Debug, 0, "Default system language: " + Lang.Language);
string[] languageFiles = Directory.GetFiles(ClientEnvironment.LanguagePath);
Logger.Log(LogLevel.Debug, 0, "Initializing local language files...");
As you can see, there are only two "real" code lines. This makes the code somewhat hard to read. I wonder whether I can specify some custom code formatting rule within Visual Studio to let the logging lines appear in a soft gray text color, instead of the default text color. This would lead to an implicit highlighting of the "real" code lines, resulting in a more readable code.
I need something like:
If statement starts with "logger.Log", set foreground color to gray.
Do you know any plugins which could archieve such a behaviour? Thank you in advance.
altrue.CustomColoring extension allows to set custom foreground color based on simple regular expressions. Restart Vs Code after installing it, it won't work correctly without restart.
https://marketplace.visualstudio.com/items?itemName=altrue.CustomColoring
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With