Skip to content

Commit fd0c59c

Browse files
authored
Merge pull request #1623 from paulvanbrenk/removeLogger
Remove logger which is no longer used,
2 parents af23881 + 635e955 commit fd0c59c

File tree

8 files changed

+12
-173
lines changed

8 files changed

+12
-173
lines changed

Nodejs/Product/Nodejs/Logging/INodejsToolsLogger.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

Nodejs/Product/Nodejs/Logging/InMemoryLogger.cs

Lines changed: 0 additions & 46 deletions
This file was deleted.

Nodejs/Product/Nodejs/Logging/NodejsToolsLogEvent.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.

Nodejs/Product/Nodejs/Logging/NodejsToolsLogger.cs

Lines changed: 0 additions & 26 deletions
This file was deleted.

Nodejs/Product/Nodejs/Nodejs.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,7 @@
245245
<Compile Include="Debugger\LocalFileNameMapper.cs" />
246246
<Compile Include="Debugger\NodeProcess.cs" />
247247
<Compile Include="Debugger\ScriptTree.cs" />
248-
<Compile Include="Logging\InMemoryLogger.cs" />
249-
<Compile Include="Logging\INodejsToolsLogger.cs" />
250248
<Compile Include="Logging\LiveLogger.cs" />
251-
<Compile Include="Logging\NodejsToolsLogEvent.cs" />
252-
<Compile Include="Logging\NodejsToolsLogger.cs" />
253249
<Compile Include="NodejsPackage.Debugger.cs" />
254250
<Compile Include="NpmUI\LastRefreshedMessageProvider.cs" />
255251
<Compile Include="NpmUI\NpmInstallWindowResources.Designer.cs">

Nodejs/Product/Nodejs/NodejsPackage.cs

Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@
66
using System.Diagnostics;
77
using System.Globalization;
88
using System.IO;
9-
using System.Linq;
109
using System.Runtime.InteropServices;
1110
using System.Windows.Forms;
1211
using Microsoft.NodejsTools.Commands;
1312
using Microsoft.NodejsTools.Debugger.DebugEngine;
1413
using Microsoft.NodejsTools.Debugger.Remote;
1514
using Microsoft.NodejsTools.Jade;
16-
using Microsoft.NodejsTools.Logging;
1715
using Microsoft.NodejsTools.Options;
1816
using Microsoft.NodejsTools.Project;
1917
using Microsoft.NodejsTools.ProjectWizard;
@@ -66,13 +64,13 @@ namespace Microsoft.NodejsTools
6664
internal sealed partial class NodejsPackage : CommonPackage
6765
{
6866
internal const string NodeExpressionEvaluatorGuid = "{F16F2A71-1C45-4BAB-BECE-09D28CFDE3E6}";
69-
private IContentType _contentType;
67+
private IContentType contentType;
7068
internal static NodejsPackage Instance;
7169
internal HashSet<ITextBuffer> ChangedBuffers = new HashSet<ITextBuffer>();
72-
private NodejsToolsLogger _logger;
70+
7371
// Hold references for the subscribed events. Otherwise the callbacks will be garbage collected
7472
// after the initialization
75-
private List<EnvDTE.CommandEvents> _subscribedCommandEvents = new List<EnvDTE.CommandEvents>();
73+
private readonly List<EnvDTE.CommandEvents> subscribedCommandEvents = new List<EnvDTE.CommandEvents>();
7674

7775
/// <summary>
7876
/// Default constructor of the package.
@@ -125,21 +123,18 @@ protected override void Initialize()
125123
new SendFeedbackCommand(),
126124
new ShowDocumentationCommand()
127125
};
126+
128127
try
129128
{
130129
commands.Add(new AzureExplorerAttachDebuggerCommand());
131130
}
132131
catch (NotSupportedException)
133132
{
134133
}
135-
RegisterCommands(commands, Guids.NodejsCmdSet);
136134

135+
RegisterCommands(commands, Guids.NodejsCmdSet);
137136
MakeDebuggerContextAvailable();
138137

139-
InitializeLogging();
140-
141-
InitializeTelemetry();
142-
143138
// The variable is inherited by child processes backing Test Explorer, and is used in
144139
// the NTVS test discoverer and test executor to connect back to VS.
145140
Environment.SetEnvironmentVariable(NodejsConstants.NodeToolsProcessIdEnvironmentVariable, Process.GetCurrentProcess().Id.ToString());
@@ -174,25 +169,11 @@ private void SubscribeToVsCommandEvents(
174169
{
175170
targetEvent.AfterExecute += afterExecute;
176171
}
177-
this._subscribedCommandEvents.Add(targetEvent);
178-
}
179-
180-
private void InitializeLogging()
181-
{
182-
this._logger = new NodejsToolsLogger(this.ComponentModel.GetExtensions<INodejsToolsLogger>().ToArray());
183-
}
184-
185-
private void InitializeTelemetry()
186-
{
187-
// Fetch the session synchronously on the UI thread; if this doesn't happen before we try using this on
188-
// the background thread then the VS process will deadlock.
189-
TelemetryHelper.Initialize();
172+
this.subscribedCommandEvents.Add(targetEvent);
190173
}
191174

192175
public new IComponentModel ComponentModel => this.GetComponentModel();
193176

194-
internal NodejsToolsLogger Logger => this._logger;
195-
196177
/// <summary>
197178
/// Makes the debugger context available - this enables our debugger when we're installed into
198179
/// a SKU which doesn't support every installed debugger.
@@ -201,8 +182,8 @@ private void MakeDebuggerContextAvailable()
201182
{
202183
var monitorSelection = (IVsMonitorSelection)GetService(typeof(SVsShellMonitorSelection));
203184
var debugEngineGuid = AD7Engine.DebugEngineGuid;
204-
uint contextCookie;
205-
if (ErrorHandler.Succeeded(monitorSelection.GetCmdUIContextCookie(ref debugEngineGuid, out contextCookie)))
185+
186+
if (ErrorHandler.Succeeded(monitorSelection.GetCmdUIContextCookie(ref debugEngineGuid, out var contextCookie)))
206187
{
207188
ErrorHandler.ThrowOnFailure(monitorSelection.SetCmdUIContext(contextCookie, 1));
208189
}
@@ -262,11 +243,11 @@ private IContentType ReplContentType
262243
{
263244
get
264245
{
265-
if (this._contentType == null)
246+
if (this.contentType == null)
266247
{
267-
this._contentType = this.ComponentModel.GetService<IContentTypeRegistryService>().GetContentType(NodejsConstants.TypeScript);
248+
this.contentType = this.ComponentModel.GetService<IContentTypeRegistryService>().GetContentType(NodejsConstants.TypeScript);
268249
}
269-
return this._contentType;
250+
return this.contentType;
270251
}
271252
}
272253

@@ -358,15 +339,5 @@ public string BrowseForDirectory(IntPtr owner, string initialDirectory = null)
358339
}
359340
}
360341
}
361-
362-
internal static void NavigateTo(string filename, int line, int col)
363-
{
364-
VsUtilities.NavigateTo(Instance, filename, Guid.Empty, line, col);
365-
}
366-
367-
internal static void NavigateTo(string filename, int pos)
368-
{
369-
VsUtilities.NavigateTo(Instance, filename, Guid.Empty, pos);
370-
}
371342
}
372343
}

Nodejs/Product/Nodejs/Project/NodejsProjectLauncher.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,10 @@ public NodejsProjectLauncher(NodejsProjectNode project)
5252
#region IProjectLauncher Members
5353
public int LaunchProject(bool debug)
5454
{
55-
NodejsPackage.Instance.Logger.LogEvent(Logging.NodejsToolsLogEvent.Launch, debug ? 1 : 0);
56-
return Start(ResolveStartupFile(), debug);
55+
return LaunchFile(ResolveStartupFile(), debug);
5756
}
5857

5958
public int LaunchFile(string file, bool debug)
60-
{
61-
NodejsPackage.Instance.Logger.LogEvent(Logging.NodejsToolsLogEvent.Launch, debug ? 1 : 0);
62-
return Start(file, debug);
63-
}
64-
65-
private int Start(string file, bool debug)
6659
{
6760
var nodePath = GetNodePath();
6861

Nodejs/Product/Nodejs/Telemetry/TelemetryHelper.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
22

3-
using Microsoft.VisualStudio.Shell;
43
using Microsoft.VisualStudio.Telemetry;
54
using static Microsoft.NodejsTools.Telemetry.TelemetryEvents;
65
using static Microsoft.NodejsTools.Telemetry.TelemetryProperties;
@@ -12,12 +11,6 @@ namespace Microsoft.NodejsTools.Telemetry
1211
/// </summary>
1312
internal static class TelemetryHelper
1413
{
15-
public static void Initialize()
16-
{
17-
ThreadHelper.ThrowIfNotOnUIThread();
18-
var defaultSession = TelemetryService.DefaultSession;
19-
}
20-
2114
public static void LogProjectImported()
2215
{
2316
TelemetryService.DefaultSession.PostUserTask(ProjectImported, TelemetryResult.Success);

0 commit comments

Comments
 (0)