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

Add lsp server name to log name #51684

Merged
merged 2 commits into from
Mar 5, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public static async Task<InProcLanguageServer> CreateAsync(
VSExtensionUtilities.AddVSExtensionConverters(jsonMessageFormatter.JsonSerializer);

var jsonRpc = new JsonRpc(new HeaderDelimitedMessageHandler(outputStream, inputStream, jsonMessageFormatter));
var logger = await CreateLoggerAsync(asyncServiceProvider, clientName, jsonRpc, cancellationToken).ConfigureAwait(false);
var logger = await CreateLoggerAsync(asyncServiceProvider, languageClient.GetType().Name, clientName, jsonRpc, cancellationToken).ConfigureAwait(false);

return new InProcLanguageServer(
languageClient,
Expand All @@ -140,14 +140,15 @@ public static async Task<InProcLanguageServer> CreateAsync(

private static async Task<LogHubLspLogger?> CreateLoggerAsync(
VSShell.IAsyncServiceProvider? asyncServiceProvider,
string serverName,
string? clientName,
JsonRpc jsonRpc,
CancellationToken cancellationToken)
{
if (asyncServiceProvider == null)
return null;

var logName = $"Roslyn.{clientName ?? "Default"}.{Interlocked.Increment(ref s_logHubSessionId)}";
var logName = $"Roslyn.{serverName}.{clientName ?? "Default"}.{Interlocked.Increment(ref s_logHubSessionId)}";
var logId = new LogId(logName, new ServiceMoniker(typeof(InProcLanguageServer).FullName));

var serviceContainer = await VSShell.ServiceExtensions.GetServiceAsync<SVsBrokeredServiceContainer, IBrokeredServiceContainer>(asyncServiceProvider).ConfigureAwait(false);
Expand Down