Skip to content

Commit 8b29e65

Browse files
committed
feat: add show goose logs as a command
1 parent c89c41a commit 8b29e65

4 files changed

Lines changed: 21 additions & 3 deletions

File tree

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@
9393
{
9494
"command": "goose.askAboutSelection",
9595
"title": "Ask Goose about this code"
96+
},
97+
{
98+
"command": "goose.showLogs",
99+
"title": "Goose: Show Extension Logs"
96100
}
97101
],
98102
"menus": {

src/extension.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,12 @@ export function activate(context: vscode.ExtensionContext) {
857857
});
858858
// --- End Configuration Change Listener ---
859859

860+
// Register command to show logs
861+
const showLogsDisposable = vscode.commands.registerCommand('goose.showLogs', () => {
862+
logger.info('Executing command: goose.showLogs');
863+
logger.showOutputChannel();
864+
});
865+
860866
// Add all disposables to the extension context's subscriptions
861867
context.subscriptions.push(
862868
viewRegistration,
@@ -868,7 +874,8 @@ export function activate(context: vscode.ExtensionContext) {
868874
codeActionRegistration,
869875
listSessionsDisposable,
870876
themeChangeListener,
871-
loggingConfigListener // Add the logging config listener
877+
loggingConfigListener,
878+
showLogsDisposable
872879
);
873880
}
874881

src/test/extension.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ suite('Extension Test Suite', () => {
9595
// Check that context.subscriptions was updated (command disposables should be pushed)
9696
assert.strictEqual(
9797
context.subscriptions?.length,
98-
10, // Updated from 9 to 10 to account for themeChangeListener
99-
'Expected 10 subscriptions to be added to context'
98+
11, // Updated from 10 to 11 to account for showLogsDisposable
99+
'Expected 11 subscriptions to be added to context'
100100
);
101101
} finally {
102102
// Restore the stubs

src/utils/logger.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,13 @@ export class Logger implements ILogger {
135135
this.log(LogLevel.ERROR, message, ...args);
136136
}
137137

138+
/**
139+
* Shows the VS Code output channel associated with this logger.
140+
*/
141+
public showOutputChannel(): void {
142+
this.outputChannel.show();
143+
}
144+
138145
/**
139146
* Central log processing method.
140147
*/

0 commit comments

Comments
 (0)