cake-build / cake-build/bakery

Cake.Bakery logging output does not get displayed in VS Code

Open
#164 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
30
Forks
11
PR merge metrics
No merged PRs in 30d

Description

Cake.Bakery logging is not turned on when it gets launched by OmniSharp.

`Cake.Scripting.Transport.Tcp.Client.ScriptGenerationProcess` will never pass `--verbose` argument to _Cake.Bakery.exe_.

**Reason:**
1. `Cake.Scripting.Transport` uses `LoggerFactory` which is passed to it by OmniSharp.
2. Bakery `ScriptGenerationProcess` expects following condition to be met in order to enable verbose logging:
```
if (_logger.IsEnabled(LogLevel.Debug))
{
arguments += " --verbose";
}
```
3. OmniSharp has logging filter which will never enable any logging from non OmniSharp namespaces as follows (CompositionHostBuilder.cs):
```
services.AddLogging(builder =>
{
var workspaceInformationServiceName = typeof(WorkspaceInformationService).FullName;
var projectEventForwarder = typeof(ProjectEventForwarder).FullName;

builder.AddFilter(
(category, logLevel) =>
environment.LogLevel <= logLevel &&
// NOTICE BELOW LINE. Condition from point #1 of this bug report will always return false. Category is Cake.Scripting.Transport.Tcp.Client.ScriptGenerationProcess
category.StartsWith("OmniSharp", StringComparison.OrdinalIgnoreCase) &&
!category.Equals(workspaceInformationServiceName, StringComparison.OrdinalIgnoreCase) &&
!category.Equals(projectEventForwarder, StringComparison.OrdinalIgnoreCase));

configureLogging?.Invoke(builder);
});
```
This could be considered a bug either in OmniSharp (due to log filter) or Cake.Bakery ScriptGenerationProcess.

Some options are:
- Allow external configuration of logging, beside command line
- For assembles which are hosted in OmniSharp process, rename namespaces to start with OmniSharp

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by inspecting Cake.Scripting.Transport.Tcp.Client.ScriptGenerationProcess and the logging filter shown from CompositionHostBuilder.cs. Reproduce the OmniSharp launch path in VS Code and determine how verbose logging should be enabled; done means Cake.Bakery logging output is displayed without relying on an unsuitable namespace filter.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.