-
Notifications
You must be signed in to change notification settings - Fork 420
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
Register the LanguageServerLogger only once #2473
Register the LanguageServerLogger only once #2473
Conversation
@@ -62,7 +62,7 @@ public class LanguageServerHost : IDisposable | |||
.WithInput(input) | |||
.WithOutput(output) | |||
// initializeParams from the client won't be arriving yet, configure with app loglevel | |||
.ConfigureLogging(GetLogBuilderAction(configureLogging, application.LogLevel)) | |||
.ConfigureLogging(AddLanguageProtocolLogging(application.LogLevel)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously there were two calls to GetLogBuilderAction
, one here and one when building the composition (after initialize). Both calls registered the lsp logger and so we got double logs.
I modified this to register the LSP logger initially (with default level) and then configure it on composition building (after initialize).
b058805
to
3c7c9cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (commit 1), with a couple of formatting nits.
private static Action<ILoggingBuilder> GetLogBuilderAction(Action<ILoggingBuilder> configureLogging, LogLevel loglevel) => builder => | ||
private static Action<ILoggingBuilder> AddLanguageProtocolLogging(LogLevel loglevel) => builder => builder.AddLanguageProtocolLogging().SetMinimumLevel(loglevel); | ||
|
||
private static Action<ILoggingBuilder> ConfigureLogging(Action<ILoggingBuilder> configureLogging, LogLevel loglevel) => builder => | ||
{ | ||
configureLogging?.Invoke(builder); | ||
builder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: consider joining these lines.
@@ -178,11 +178,12 @@ private static LogLevel GetLogLevel(InitializeTrace initializeTrace) | |||
} | |||
} | |||
|
|||
private static Action<ILoggingBuilder> GetLogBuilderAction(Action<ILoggingBuilder> configureLogging, LogLevel loglevel) => builder => | |||
private static Action<ILoggingBuilder> AddLanguageProtocolLogging(LogLevel loglevel) => builder => builder.AddLanguageProtocolLogging().SetMinimumLevel(loglevel); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: consider wrapping this line.
…om/dibarbet/omnisharp-roslyn into register_languageserverlogger_once
Fixes bug where logs were duplicated when using the LSP version. Logged in dotnet/vscode-csharp#5429