In vs code, logs from the debug provider and the console provider both show up in the debug console. This ends up duplicating all the logs, and since they're in different formats, makes it really difficult to read and understand.
To make things worse they're not in color. Lame 🙄.
Since the console provider already logs to the debug console, I tend to just turn the debug provider off:
// appsettings.Development.json
{
"Logging": {
...
"Debug": {
"LogLevel": {
+ "LogLevel": "None"
}
}
}
}
And we get much less! ...exactly half as much 🤓
So... how bout color? Color would make it a hell of a lot easier to find that error I decided to log earlier (instead of fix), and I recently just so happen to come across this little gem 😍
"DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION": "true"
It can be set in your launchSettings.json or vscode launch.json files.
Tip
Add it to your global launch.json and forget it
Finally, if you're the type that selects compact mode in for your Teams and email threads, we've got something for you too:
// appsettings.Development.json
{
"Logging": {
"Console": {
...
+ "FormatterOptions": {
+ "SingleLine": true
+ }
}
}
}
I've found that a couple more settings will reduce the noise in your logs when developing locally:
//.vscode/settings.json
{
"csharp.debug.logging.moduleLoad": false,
"csharp.debug.logging.exceptions": false
}