Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
19 changes: 8 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,31 +368,28 @@ The `aws.dev.forceDevMode` setting enables or disables Toolkit "dev mode". Witho
```
tail -F ~/awstoolkit.log
```
- Use the `AWS (Developer): Watch Logs` command to watch and filter Toolkit logs (including
telemetry) in VSCode.
- Only available if you enabled "dev mode" (`aws.dev.forceDevMode` setting, see above).
- Enter text in the Debug Console filter box to show only log messages with that text. <br/>
<img src="./docs/images/debug-console-filter.png" alt="VSCode Debug Console" width="320"/>
- Use the Output panel to watch and filter Toolkit logs (including telemetry) in VSCode.
- Enter text in the Output panel filter box to show only log messages with that text.

#### Enabling Debug Logs

How to enable more detailed debug logs in the extensions.
If you need to report an issue attach these to give the most detailed information.

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`
![](./docs/images/logsView.png)
1. Open the Command Palette (`cmd/ctrl` + `shift` + `p`), then search for "View Logs". Choose either `AWS: View Logs` or `Amazon Q: View Logs`.
- ![](./docs/images/logsView.png)
2. Click the gear icon on the bottom right and select `Debug`
![](./docs/images/logsSetDebug.png)
- ![](./docs/images/logsSetDebug.png)
3. Click the gear icon again and select `Set As Default`. This will ensure we stay in `Debug` until explicitly changed
![](./docs/images/logsSetDefault.png)
- ![](./docs/images/logsSetDefault.png)
4. Open the Command Palette again and select `Reload Window`.
5. Now you should see additional `[debug]` prefixed logs in the output.
![](./docs/images/logsDebugLog.png)
- ![](./docs/images/logsDebugLog.png)

### Telemetry

- See [docs/telemetry.md](./docs/telemetry.md) for guidelines on developing telemetry in this project.
- 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.
- To watch Toolkit telemetry events, use the `Amazon Q: View Logs` command (see [Logging](#logging) above) and enter "telemetry" in the filter box.

### Service Endpoints

Expand Down
Binary file removed docs/images/debug-console-filter.png
Binary file not shown.
14 changes: 0 additions & 14 deletions packages/core/src/dev/activation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,20 +199,6 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
.filter((e) => (opts.menuOptions ?? Object.keys(options)).includes(e[0]))
.map((e) => e[1])
)
}),
// "AWS (Developer): Watch Logs"
Commands.register('aws.dev.viewLogs', async () => {
// HACK: Use startDebugging() so we can use the DEBUG CONSOLE (which supports
// user-defined filtering, unlike the OUTPUT panel).
await vscode.debug.startDebugging(undefined, {
name: 'aws-dev-log',
request: 'launch',
type: 'node', // Nonsense, to force the debugger to start.
})
getLogger().enableDebugConsole()
if (!getLogger().logLevelEnabled('debug')) {
getLogger().setLogLevel('debug')
}
})
)

Expand Down
10 changes: 0 additions & 10 deletions packages/core/src/shared/logger/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export interface Logger {
/** Returns true if the given log level is being logged. */
logLevelEnabled(logLevel: LogLevel): boolean
getLogById(logID: number, file: vscode.Uri): string | undefined
/** HACK: Enables logging to vscode Debug Console. */
enableDebugConsole(): void
sendToLog(
logLevel: 'debug' | 'verbose' | 'info' | 'warn' | 'error',
message: string | Error,
Expand Down Expand Up @@ -74,8 +72,6 @@ export abstract class BaseLogger implements Logger {
abstract setLogLevel(logLevel: LogLevel): void
abstract logLevelEnabled(logLevel: LogLevel): boolean
abstract getLogById(logID: number, file: vscode.Uri): string | undefined
/** HACK: Enables logging to vscode Debug Console. */
abstract enableDebugConsole(): void
}

/**
Expand Down Expand Up @@ -166,7 +162,6 @@ export class NullLogger extends BaseLogger {
public getLogById(logID: number, file: vscode.Uri): string | undefined {
return undefined
}
public enableDebugConsole(): void {}
override sendToLog(
logLevel: 'error' | 'warn' | 'info' | 'verbose' | 'debug',
message: string | Error,
Expand All @@ -190,7 +185,6 @@ export class ConsoleLogger extends BaseLogger {
public getLogById(logID: number, file: vscode.Uri): string | undefined {
return undefined
}
public enableDebugConsole(): void {}
override sendToLog(
logLevel: 'error' | 'warn' | 'info' | 'verbose' | 'debug',
message: string | Error,
Expand Down Expand Up @@ -244,10 +238,6 @@ export class TopicLogger extends BaseLogger implements vscode.Disposable {
return this.logger.getLogById(logID, file)
}

override enableDebugConsole(): void {
this.logger.enableDebugConsole()
}

override sendToLog(level: LogLevel, message: string | Error, ...meta: any[]): number {
if (typeof message === 'string') {
message = prependTopic(this.topic, message) as string
Expand Down
4 changes: 0 additions & 4 deletions packages/core/src/shared/logger/toolkitLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ export class ToolkitLogger extends BaseLogger implements vscode.Disposable {
})
}

public enableDebugConsole(): void {
this.logToConsole()
}

public setLogLevel(logLevel: LogLevel) {
if (this.logger.level === logLevel) {
return
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/test/testLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ export class TestLogger extends BaseLogger {
super()
}

public enableDebugConsole(): void {}

public getLoggedEntries(...logLevels: LogLevel[]): Loggable[] {
return this.loggedEntries
.filter((loggedEntry) => logLevels.length === 0 || logLevels.includes(loggedEntry.logLevel))
Expand Down
5 changes: 0 additions & 5 deletions packages/toolkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3891,11 +3891,6 @@
"category": "AWS (Developer)",
"enablement": "aws.isDevMode"
},
{
"command": "aws.dev.viewLogs",
"title": "Watch Logs",
"category": "AWS (Developer)"
},
{
"command": "aws.openInApplicationComposerDialog",
"title": "%AWS.command.applicationComposer.openDialog%",
Expand Down
Loading