Skip to content
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

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

Open
nikola-nignite opened this issue Dec 10, 2021 · 0 comments
Open

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

nikola-nignite opened this issue Dec 10, 2021 · 0 comments

Comments

@nikola-nignite
Copy link

nikola-nignite commented Dec 10, 2021

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";
}
  1. 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant