Skip to content

Commit 53f11e7

Browse files
authored
refactor(logs): remove "Watch Logs" command #6533
## Problem The vscode Output panel now supports filtering: https://code.visualstudio.com/updates/v1_97#_output-panel-filtering This means we no longer need the `AWS (Developer): Watch Logs` command. ## Solution Remove the `AWS (Developer): Watch Logs` command.
1 parent b398769 commit 53f11e7

File tree

7 files changed

+8
-46
lines changed

7 files changed

+8
-46
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -368,31 +368,28 @@ The `aws.dev.forceDevMode` setting enables or disables Toolkit "dev mode". Witho
368368
```
369369
tail -F ~/awstoolkit.log
370370
```
371-
- Use the `AWS (Developer): Watch Logs` command to watch and filter Toolkit logs (including
372-
telemetry) in VSCode.
373-
- Only available if you enabled "dev mode" (`aws.dev.forceDevMode` setting, see above).
374-
- Enter text in the Debug Console filter box to show only log messages with that text. <br/>
375-
<img src="./docs/images/debug-console-filter.png" alt="VSCode Debug Console" width="320"/>
371+
- Use the Output panel to watch and filter Toolkit logs (including telemetry) in VSCode.
372+
- Enter text in the Output panel filter box to show only log messages with that text.
376373
377374
#### Enabling Debug Logs
378375
379376
How to enable more detailed debug logs in the extensions.
380377
If you need to report an issue attach these to give the most detailed information.
381378
382-
1. Open the Command Palette (`cmd/ctrl` + `shift` + `p`), then search for "View Logs". Choose the correct option for the extension you want, eg: `AWS: View Logs` or `Amazon Q: View Logs`
383-
![](./docs/images/logsView.png)
379+
1. Open the Command Palette (`cmd/ctrl` + `shift` + `p`), then search for "View Logs". Choose either `AWS: View Logs` or `Amazon Q: View Logs`.
380+
- ![](./docs/images/logsView.png)
384381
2. Click the gear icon on the bottom right and select `Debug`
385-
![](./docs/images/logsSetDebug.png)
382+
- ![](./docs/images/logsSetDebug.png)
386383
3. Click the gear icon again and select `Set As Default`. This will ensure we stay in `Debug` until explicitly changed
387-
![](./docs/images/logsSetDefault.png)
384+
- ![](./docs/images/logsSetDefault.png)
388385
4. Open the Command Palette again and select `Reload Window`.
389386
5. Now you should see additional `[debug]` prefixed logs in the output.
390-
![](./docs/images/logsDebugLog.png)
387+
- ![](./docs/images/logsDebugLog.png)
391388
392389
### Telemetry
393390
394391
- See [docs/telemetry.md](./docs/telemetry.md) for guidelines on developing telemetry in this project.
395-
- To watch Toolkit telemetry events, use the `AWS (Developer): Watch Logs` command (see [Logging](#logging) above) and enter "telemetry" in the Debug Console filter box.
392+
- To watch Toolkit telemetry events, use the `Amazon Q: View Logs` command (see [Logging](#logging) above) and enter "telemetry" in the filter box.
396393
397394
### Service Endpoints
398395

docs/images/debug-console-filter.png

-22.9 KB
Binary file not shown.

packages/core/src/dev/activation.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -199,20 +199,6 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
199199
.filter((e) => (opts.menuOptions ?? Object.keys(options)).includes(e[0]))
200200
.map((e) => e[1])
201201
)
202-
}),
203-
// "AWS (Developer): Watch Logs"
204-
Commands.register('aws.dev.viewLogs', async () => {
205-
// HACK: Use startDebugging() so we can use the DEBUG CONSOLE (which supports
206-
// user-defined filtering, unlike the OUTPUT panel).
207-
await vscode.debug.startDebugging(undefined, {
208-
name: 'aws-dev-log',
209-
request: 'launch',
210-
type: 'node', // Nonsense, to force the debugger to start.
211-
})
212-
getLogger().enableDebugConsole()
213-
if (!getLogger().logLevelEnabled('debug')) {
214-
getLogger().setLogLevel('debug')
215-
}
216202
})
217203
)
218204

packages/core/src/shared/logger/logger.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ export interface Logger {
3535
/** Returns true if the given log level is being logged. */
3636
logLevelEnabled(logLevel: LogLevel): boolean
3737
getLogById(logID: number, file: vscode.Uri): string | undefined
38-
/** HACK: Enables logging to vscode Debug Console. */
39-
enableDebugConsole(): void
4038
sendToLog(
4139
logLevel: 'debug' | 'verbose' | 'info' | 'warn' | 'error',
4240
message: string | Error,
@@ -74,8 +72,6 @@ export abstract class BaseLogger implements Logger {
7472
abstract setLogLevel(logLevel: LogLevel): void
7573
abstract logLevelEnabled(logLevel: LogLevel): boolean
7674
abstract getLogById(logID: number, file: vscode.Uri): string | undefined
77-
/** HACK: Enables logging to vscode Debug Console. */
78-
abstract enableDebugConsole(): void
7975
}
8076

8177
/**
@@ -166,7 +162,6 @@ export class NullLogger extends BaseLogger {
166162
public getLogById(logID: number, file: vscode.Uri): string | undefined {
167163
return undefined
168164
}
169-
public enableDebugConsole(): void {}
170165
override sendToLog(
171166
logLevel: 'error' | 'warn' | 'info' | 'verbose' | 'debug',
172167
message: string | Error,
@@ -190,7 +185,6 @@ export class ConsoleLogger extends BaseLogger {
190185
public getLogById(logID: number, file: vscode.Uri): string | undefined {
191186
return undefined
192187
}
193-
public enableDebugConsole(): void {}
194188
override sendToLog(
195189
logLevel: 'error' | 'warn' | 'info' | 'verbose' | 'debug',
196190
message: string | Error,
@@ -244,10 +238,6 @@ export class TopicLogger extends BaseLogger implements vscode.Disposable {
244238
return this.logger.getLogById(logID, file)
245239
}
246240

247-
override enableDebugConsole(): void {
248-
this.logger.enableDebugConsole()
249-
}
250-
251241
override sendToLog(level: LogLevel, message: string | Error, ...meta: any[]): number {
252242
if (typeof message === 'string') {
253243
message = prependTopic(this.topic, message) as string

packages/core/src/shared/logger/toolkitLogger.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ export class ToolkitLogger extends BaseLogger implements vscode.Disposable {
4848
})
4949
}
5050

51-
public enableDebugConsole(): void {
52-
this.logToConsole()
53-
}
54-
5551
public setLogLevel(logLevel: LogLevel) {
5652
if (this.logger.level === logLevel) {
5753
return

packages/core/src/test/testLogger.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ export class TestLogger extends BaseLogger {
2323
super()
2424
}
2525

26-
public enableDebugConsole(): void {}
27-
2826
public getLoggedEntries(...logLevels: LogLevel[]): Loggable[] {
2927
return this.loggedEntries
3028
.filter((loggedEntry) => logLevels.length === 0 || logLevels.includes(loggedEntry.logLevel))

packages/toolkit/package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3891,11 +3891,6 @@
38913891
"category": "AWS (Developer)",
38923892
"enablement": "aws.isDevMode"
38933893
},
3894-
{
3895-
"command": "aws.dev.viewLogs",
3896-
"title": "Watch Logs",
3897-
"category": "AWS (Developer)"
3898-
},
38993894
{
39003895
"command": "aws.openInApplicationComposerDialog",
39013896
"title": "%AWS.command.applicationComposer.openDialog%",

0 commit comments

Comments
 (0)