Skip to content

Commit 160a903

Browse files
JustinGroteandyleejordan
authored andcommitted
Some more logging Levels and cleanup
1 parent b585308 commit 160a903

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/PowerShellEditorServices.Hosting/Configuration/HostLogger.cs

+3-5
Original file line numberDiff line numberDiff line change
@@ -229,25 +229,23 @@ public void OnNext((PsesLogLevel logLevel, string message) value)
229229
switch (logLevel)
230230
{
231231
case PsesLogLevel.Trace:
232+
ui.WriteDebugLine("[Trace] " + message);
233+
break;
232234
case PsesLogLevel.Debug:
233235
ui.WriteDebugLine(message);
234236
break;
235-
236237
case PsesLogLevel.Information:
237238
ui.WriteVerboseLine(message);
238239
break;
239-
240240
case PsesLogLevel.Warning:
241241
ui.WriteWarningLine(message);
242242
break;
243-
244243
case PsesLogLevel.Error:
245244
case PsesLogLevel.Critical:
246245
ui.WriteErrorLine(message);
247246
break;
248-
249247
default:
250-
ui.WriteLine(message);
248+
ui.WriteDebugLine("UNKNOWN:" + message);
251249
break;
252250
}
253251
}

src/PowerShellEditorServices.Hosting/EditorServicesLoader.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@ public Task LoadAndRunEditorServicesAsync()
212212
ValidateConfiguration();
213213

214214
// Method with no implementation that forces the PSES assembly to load, triggering an AssemblyResolve event
215-
_logger.Log(PsesLogLevel.Information, "Loading PowerShell Editor Services");
215+
_logger.Log(PsesLogLevel.Information, "Loading PowerShell Editor Services Assemblies");
216216
LoadEditorServices();
217217

218-
_logger.Log(PsesLogLevel.Information, "Starting EditorServices");
218+
_logger.Log(PsesLogLevel.Information, "Starting PowerShell Editor Services");
219219

220220
_editorServicesRunner = new EditorServicesRunner(_logger, _hostConfig, _sessionFileWriter, _loggersToUnsubscribe);
221221

@@ -242,7 +242,7 @@ private void CheckPowerShellVersion()
242242
{
243243
PSLanguageMode languageMode = Runspace.DefaultRunspace.SessionStateProxy.LanguageMode;
244244

245-
_logger.Log(PsesLogLevel.Debug, $@"
245+
_logger.Log(PsesLogLevel.Trace, $@"
246246
== PowerShell Details ==
247247
- PowerShell version: {_powerShellVersion}
248248
- Language mode: {languageMode}
@@ -295,12 +295,12 @@ private void UpdatePSModulePath()
295295
}
296296
psModulePath = $"{psModulePath}{Path.PathSeparator}{_hostConfig.BundledModulePath}";
297297
Environment.SetEnvironmentVariable("PSModulePath", psModulePath);
298-
_logger.Log(PsesLogLevel.Debug, $"Updated PSModulePath to: '{psModulePath}'");
298+
_logger.Log(PsesLogLevel.Trace, $"Updated PSModulePath to: '{psModulePath}'");
299299
}
300300

301301
private void LogHostInformation()
302302
{
303-
_logger.Log(PsesLogLevel.Debug, $"PID: {System.Diagnostics.Process.GetCurrentProcess().Id}");
303+
_logger.Log(PsesLogLevel.Trace, $"PID: {System.Diagnostics.Process.GetCurrentProcess().Id}");
304304

305305
_logger.Log(PsesLogLevel.Debug, $@"
306306
== Build Details ==
@@ -359,7 +359,7 @@ private static string GetPSOutputEncoding()
359359
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA2208:Instantiate argument exceptions correctly", Justification = "Checking user-defined configuration")]
360360
private void ValidateConfiguration()
361361
{
362-
_logger.Log(PsesLogLevel.Trace, "Validating configuration");
362+
_logger.Log(PsesLogLevel.Debug, "Validating configuration");
363363

364364
bool lspUsesStdio = _hostConfig.LanguageServiceTransport is StdioTransportConfig;
365365
bool debugUsesStdio = _hostConfig.DebugServiceTransport is StdioTransportConfig;

0 commit comments

Comments
 (0)