Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 79954e2

Browse files
JustinGroteandyleejordan
authored andcommitted
Align logging terminology to vscode output windows and remove editorServices from options definitions
1 parent 60ddcce commit 79954e2

File tree

11 files changed

+54
-64
lines changed

11 files changed

+54
-64
lines changed

‎docs/troubleshooting.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,11 @@ Logs provide context for what was happening when the issue occurred. **You shoul
253253
your logs for any sensitive information you would not like to share online!**
254254

255255
* Before sending through logs, try and reproduce the issue with **log level set to
256-
Diagnostic**. You can set this in the [VS Code Settings][]
256+
Trace**. You can set this in the [VS Code Settings][]
257257
(<kbd>Ctrl</kbd>+<kbd>,</kbd>) with:
258258

259259
```json
260-
"powershell.developer.editorServicesLogLevel": "Diagnostic"
260+
"powershell.developer.editorServicesLogLevel": "Trace"
261261
```
262262

263263
* After you have captured the issue with the log level turned up, you may want to return

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@
933933
"Only log errors.",
934934
"Disable all logging possible. No log files will be written!"
935935
],
936-
"markdownDescription": "Sets the log verbosity for both the extension and its LSP server, PowerShell Editor Services. **Please set to `Diagnostic` when recording logs for a bug report!**"
936+
"markdownDescription": "Sets the log verbosity for both the extension and its LSP server, PowerShell Editor Services. **Please set to `Trace` when recording logs for a bug report!**"
937937
},
938938
"powershell.developer.editorServicesWaitForDebugger": {
939939
"type": "boolean",

‎src/extension.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<IPower
4848
telemetryReporter = new TelemetryReporter(TELEMETRY_KEY);
4949

5050
const settings = getSettings();
51-
logger.writeVerbose(`Loaded settings:\n${JSON.stringify(settings, undefined, 2)}`);
51+
logger.writeDebug(`Loaded settings:\n${JSON.stringify(settings, undefined, 2)}`);
5252

5353
languageConfigurationDisposable = vscode.languages.setLanguageConfiguration(
5454
PowerShellLanguageId,

‎src/features/DebugSession.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,8 @@ export class DebugSessionFeature extends LanguageClientConsumer
335335
// Create or show the debug terminal (either temporary or session).
336336
this.sessionManager.showDebugTerminal(true);
337337

338-
this.logger.writeVerbose(`Connecting to pipe: ${sessionDetails.debugServicePipeName}`);
339-
this.logger.writeVerbose(`Debug configuration: ${JSON.stringify(session.configuration, undefined, 2)}`);
338+
this.logger.writeDebug(`Connecting to pipe: ${sessionDetails.debugServicePipeName}`);
339+
this.logger.writeDebug(`Debug configuration: ${JSON.stringify(session.configuration, undefined, 2)}`);
340340

341341
return new DebugAdapterNamedPipeServer(sessionDetails.debugServicePipeName);
342342
}
@@ -424,7 +424,7 @@ export class DebugSessionFeature extends LanguageClientConsumer
424424
// The dispose shorthand demonry for making an event one-time courtesy of: https://github.com/OmniSharp/omnisharp-vscode/blob/b8b07bb12557b4400198895f82a94895cb90c461/test/integrationTests/launchConfiguration.integration.test.ts#L41-L45
425425
startDebugEvent.dispose();
426426

427-
this.logger.writeVerbose(`Debugger session detected: ${dotnetAttachSession.name} (${dotnetAttachSession.id})`);
427+
this.logger.writeDebug(`Debugger session detected: ${dotnetAttachSession.name} (${dotnetAttachSession.id})`);
428428

429429
tempConsoleDotnetAttachSession = dotnetAttachSession;
430430

@@ -434,7 +434,7 @@ export class DebugSessionFeature extends LanguageClientConsumer
434434
// Makes the event one-time
435435
stopDebugEvent.dispose();
436436

437-
this.logger.writeVerbose(`Debugger session terminated: ${tempConsoleSession.name} (${tempConsoleSession.id})`);
437+
this.logger.writeDebug(`Debugger session terminated: ${tempConsoleSession.name} (${tempConsoleSession.id})`);
438438

439439
// HACK: As of 2023年08月17日, there is no vscode debug API to request the C# debugger to detach, so we send it a custom DAP request instead.
440440
const disconnectRequest: DebugProtocol.DisconnectRequest = {
@@ -462,8 +462,8 @@ export class DebugSessionFeature extends LanguageClientConsumer
462462
// Start a child debug session to attach the dotnet debugger
463463
// TODO: Accommodate multi-folder workspaces if the C# code is in a different workspace folder
464464
await debug.startDebugging(undefined, dotnetAttachConfig, session);
465-
this.logger.writeVerbose(`Dotnet attach debug configuration: ${JSON.stringify(dotnetAttachConfig, undefined, 2)}`);
466-
this.logger.writeVerbose(`Attached dotnet debugger to process: ${pid}`);
465+
this.logger.writeDebug(`Dotnet attach debug configuration: ${JSON.stringify(dotnetAttachConfig, undefined, 2)}`);
466+
this.logger.writeDebug(`Attached dotnet debugger to process: ${pid}`);
467467
}
468468

469469
return this.tempSessionDetails;

‎src/features/ExternalApi.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class ExternalApiFeature implements IPowerShellExtensionClient {
5656
string session uuid
5757
*/
5858
public registerExternalExtension(id: string, apiVersion = "v1"): string {
59-
this.logger.writeVerbose(`Registering extension '${id}' for use with API version '${apiVersion}'.`);
59+
this.logger.writeDebug(`Registering extension '${id}' for use with API version '${apiVersion}'.`);
6060

6161
// eslint-disable-next-line @typescript-eslint/no-unused-vars
6262
for (const [_name, externalExtension] of ExternalApiFeature.registeredExternalExtension) {
@@ -97,7 +97,7 @@ export class ExternalApiFeature implements IPowerShellExtensionClient {
9797
true if it worked, otherwise throws an error.
9898
*/
9999
public unregisterExternalExtension(uuid = ""): boolean {
100-
this.logger.writeVerbose(`Unregistering extension with session UUID: ${uuid}`);
100+
this.logger.writeDebug(`Unregistering extension with session UUID: ${uuid}`);
101101
if (!ExternalApiFeature.registeredExternalExtension.delete(uuid)) {
102102
throw new Error(`No extension registered with session UUID: ${uuid}`);
103103
}
@@ -134,7 +134,7 @@ export class ExternalApiFeature implements IPowerShellExtensionClient {
134134
*/
135135
public async getPowerShellVersionDetails(uuid = ""): Promise<IExternalPowerShellDetails> {
136136
const extension = this.getRegisteredExtension(uuid);
137-
this.logger.writeVerbose(`Extension '${extension.id}' called 'getPowerShellVersionDetails'.`);
137+
this.logger.writeDebug(`Extension '${extension.id}' called 'getPowerShellVersionDetails'.`);
138138

139139
await this.sessionManager.waitUntilStarted();
140140
const versionDetails = this.sessionManager.getPowerShellVersionDetails();
@@ -162,7 +162,7 @@ export class ExternalApiFeature implements IPowerShellExtensionClient {
162162
*/
163163
public async waitUntilStarted(uuid = ""): Promise<void> {
164164
const extension = this.getRegisteredExtension(uuid);
165-
this.logger.writeVerbose(`Extension '${extension.id}' called 'waitUntilStarted'.`);
165+
this.logger.writeDebug(`Extension '${extension.id}' called 'waitUntilStarted'.`);
166166
await this.sessionManager.waitUntilStarted();
167167
}
168168

‎src/features/UpdatePowerShell.ts‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,20 @@ export class UpdatePowerShell {
5151
private shouldCheckForUpdate(): boolean {
5252
// Respect user setting.
5353
if (!this.sessionSettings.promptToUpdatePowerShell) {
54-
this.logger.writeVerbose("Setting 'promptToUpdatePowerShell' was false.");
54+
this.logger.writeDebug("Setting 'promptToUpdatePowerShell' was false.");
5555
return false;
5656
}
5757

5858
// Respect environment configuration.
5959
if (process.env.POWERSHELL_UPDATECHECK?.toLowerCase() === "off") {
60-
this.logger.writeVerbose("Environment variable 'POWERSHELL_UPDATECHECK' was 'Off'.");
60+
this.logger.writeDebug("Environment variable 'POWERSHELL_UPDATECHECK' was 'Off'.");
6161
return false;
6262
}
6363

6464
// Skip prompting when using Windows PowerShell for now.
6565
if (this.localVersion.compare("6.0.0") === -1) {
6666
// TODO: Maybe we should announce PowerShell Core?
67-
this.logger.writeVerbose("Not prompting to update Windows PowerShell.");
67+
this.logger.writeDebug("Not prompting to update Windows PowerShell.");
6868
return false;
6969
}
7070

@@ -78,13 +78,13 @@ export class UpdatePowerShell {
7878

7979
// Skip if PowerShell is self-built, that is, this contains a commit hash.
8080
if (commit.length >= 40) {
81-
this.logger.writeVerbose("Not prompting to update development build.");
81+
this.logger.writeDebug("Not prompting to update development build.");
8282
return false;
8383
}
8484

8585
// Skip if preview is a daily build.
8686
if (daily.toLowerCase().startsWith("daily")) {
87-
this.logger.writeVerbose("Not prompting to update daily build.");
87+
this.logger.writeDebug("Not prompting to update daily build.");
8888
return false;
8989
}
9090
}
@@ -106,7 +106,7 @@ export class UpdatePowerShell {
106106
// "ReleaseTag": "v7.2.7"
107107
// }
108108
const data = await response.json();
109-
this.logger.writeVerbose(`Received from '${url}':\n${JSON.stringify(data, undefined, 2)}`);
109+
this.logger.writeDebug(`Received from '${url}':\n${JSON.stringify(data, undefined, 2)}`);
110110
return data.ReleaseTag;
111111
}
112112

@@ -115,26 +115,26 @@ export class UpdatePowerShell {
115115
return undefined;
116116
}
117117

118-
this.logger.writeVerbose("Checking for PowerShell update...");
118+
this.logger.writeDebug("Checking for PowerShell update...");
119119
const tags: string[] = [];
120120
if (process.env.POWERSHELL_UPDATECHECK?.toLowerCase() === "lts") {
121121
// Only check for update to LTS.
122-
this.logger.writeVerbose("Checking for LTS update...");
122+
this.logger.writeDebug("Checking for LTS update...");
123123
const tag = await this.getRemoteVersion(UpdatePowerShell.LTSBuildInfoURL);
124124
if (tag != undefined) {
125125
tags.push(tag);
126126
}
127127
} else {
128128
// Check for update to stable.
129-
this.logger.writeVerbose("Checking for stable update...");
129+
this.logger.writeDebug("Checking for stable update...");
130130
const tag = await this.getRemoteVersion(UpdatePowerShell.StableBuildInfoURL);
131131
if (tag != undefined) {
132132
tags.push(tag);
133133
}
134134

135135
// Also check for a preview update.
136136
if (this.localVersion.prerelease.length > 0) {
137-
this.logger.writeVerbose("Checking for preview update...");
137+
this.logger.writeDebug("Checking for preview update...");
138138
const tag = await this.getRemoteVersion(UpdatePowerShell.PreviewBuildInfoURL);
139139
if (tag != undefined) {
140140
tags.push(tag);
@@ -181,11 +181,11 @@ export class UpdatePowerShell {
181181

182182
// If the user cancels the notification.
183183
if (!result) {
184-
this.logger.writeVerbose("User canceled PowerShell update prompt.");
184+
this.logger.writeDebug("User canceled PowerShell update prompt.");
185185
return;
186186
}
187187

188-
this.logger.writeVerbose(`User said '${UpdatePowerShell.promptOptions[result.id].title}'.`);
188+
this.logger.writeDebug(`User said '${UpdatePowerShell.promptOptions[result.id].title}'.`);
189189

190190
switch (result.id) {
191191
// Yes

‎src/logging.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { LogOutputChannel, LogLevel, window, Event } from "vscode";
99
export interface ILogger {
1010
write(message: string, ...additionalMessages: string[]): void;
1111
writeAndShowInformation(message: string, ...additionalMessages: string[]): Promise<void>;
12-
writeDiagnostic(message: string, ...additionalMessages: string[]): void;
13-
writeVerbose(message: string, ...additionalMessages: string[]): void;
12+
writeTrace(message: string, ...additionalMessages: string[]): void;
13+
writeDebug(message: string, ...additionalMessages: string[]): void;
1414
writeWarning(message: string, ...additionalMessages: string[]): void;
1515
writeAndShowWarning(message: string, ...additionalMessages: string[]): Promise<void>;
1616
writeError(message: string, ...additionalMessages: string[]): void;
@@ -56,11 +56,11 @@ export class Logger implements ILogger {
5656
}
5757
}
5858

59-
public writeDiagnostic(message: string, ...additionalMessages: string[]): void {
59+
public writeTrace(message: string, ...additionalMessages: string[]): void {
6060
this.writeAtLevel(LogLevel.Trace, message, ...additionalMessages);
6161
}
6262

63-
public writeVerbose(message: string, ...additionalMessages: string[]): void {
63+
public writeDebug(message: string, ...additionalMessages: string[]): void {
6464
this.writeAtLevel(LogLevel.Debug, message, ...additionalMessages);
6565
}
6666

‎src/process.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ export class PowerShellProcess {
9090
startEditorServices);
9191
} else {
9292
// Otherwise use -EncodedCommand for better quote support.
93-
this.logger.writeVerbose("Using Base64 -EncodedCommand but logging as -Command equivalent.");
93+
this.logger.writeDebug("Using Base64 -EncodedCommand but logging as -Command equivalent.");
9494
powerShellArgs.push(
9595
"-EncodedCommand",
9696
Buffer.from(startEditorServices, "utf16le").toString("base64"));
9797
}
9898

99-
this.logger.writeVerbose(`Starting process: ${this.exePath} ${powerShellArgs.slice(0, -2).join(" ")} -Command ${startEditorServices}`);
99+
this.logger.writeDebug(`Starting process: ${this.exePath} ${powerShellArgs.slice(0, -2).join(" ")} -Command ${startEditorServices}`);
100100

101101
// Make sure no old session file exists
102102
await this.deleteSessionFile(this.sessionFilePath);
@@ -174,7 +174,7 @@ export class PowerShellProcess {
174174
}
175175

176176
public dispose(): void {
177-
this.logger.writeVerbose(`Disposing PowerShell process with PID: ${this.pid}`);
177+
this.logger.writeDebug(`Disposing PowerShell process with PID: ${this.pid}`);
178178

179179
void this.deleteSessionFile(this.sessionFilePath);
180180

@@ -227,7 +227,7 @@ export class PowerShellProcess {
227227
const warnAt = numOfTries - PowerShellProcess.warnUserThreshold;
228228

229229
// Check every second.
230-
this.logger.writeVerbose(`Waiting for session file: ${this.sessionFilePath}`);
230+
this.logger.writeDebug(`Waiting for session file: ${this.sessionFilePath}`);
231231
for (let i = numOfTries; i > 0; i--) {
232232
if (cancellationToken.isCancellationRequested) {
233233
this.logger.writeWarning("Canceled while waiting for session file.");
@@ -240,7 +240,7 @@ export class PowerShellProcess {
240240
}
241241

242242
if (await utils.checkIfFileExists(this.sessionFilePath)) {
243-
this.logger.writeVerbose("Session file found.");
243+
this.logger.writeDebug("Session file found.");
244244
return await this.readSessionFile(this.sessionFilePath);
245245
}
246246

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /