Skip to content

Commit 6d5e016

Browse files
refactor(logs): drop "Amazon Q Logs" channel and just have "Amazon Q" (#6114)
## Problem We didn't have much use for the old "Amazon Q" channel in addition to "Amazon Q Logs". All the logs we used were in "Amazon Q Logs". ## Solution - Now, just have the useful "Amazon Q Logs" channel. - Move the Amazon Q Language Server logs in to Amazon Q Logs to unify all logs --- <!--- REMINDER: Ensure that your PR meets the guidelines in CONTRIBUTING.md --> License: I confirm that my contribution is made under the terms of the Apache 2.0 license. --------- Signed-off-by: nkomonen-amazon <[email protected]>
1 parent be4b42b commit 6d5e016

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "Amazon Q: Simplify log channel"
4+
}

packages/amazonq/src/extension.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,8 @@ export async function activateAmazonQCommon(context: vscode.ExtensionContext, is
9797
globals.manifestPaths.endpoints = context.asAbsolutePath(join('resources', 'endpoints.json'))
9898
globals.regionProvider = RegionProvider.fromEndpointsProvider(makeEndpointsProvider())
9999

100-
const qOutputChannel = vscode.window.createOutputChannel('Amazon Q', { log: true })
101100
const qLogChannel = vscode.window.createOutputChannel('Amazon Q Logs', { log: true })
102-
await activateLogger(context, amazonQContextPrefix, qOutputChannel, qLogChannel)
103-
globals.outputChannel = qOutputChannel
101+
await activateLogger(context, amazonQContextPrefix, qLogChannel)
104102
globals.logOutputChannel = qLogChannel
105103
globals.loginManager = new LoginManager(globals.awsContext, new CredentialsStore())
106104

packages/core/src/amazonq/lsp/lspClient.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {
3232
} from './types'
3333
import { Writable } from 'stream'
3434
import { CodeWhispererSettings } from '../../codewhisperer/util/codewhispererSettings'
35-
import { fs, getLogger } from '../../shared'
35+
import { fs, getLogger, globals } from '../../shared'
3636

3737
const localize = nls.loadMessageBundle()
3838

@@ -228,6 +228,9 @@ export async function activate(extensionContext: ExtensionContext) {
228228
// this is used by LSP to determine index cache path, move to this folder so that when extension updates index is not deleted.
229229
extensionPath: path.join(fs.getUserHomeDir(), '.aws', 'amazonq', 'cache'),
230230
},
231+
// Log to the Amazon Q Logs so everything is in a single channel
232+
// TODO: Add prefix to the language server logs so it is easier to search
233+
outputChannel: globals.logOutputChannel,
231234
}
232235

233236
// Create the language client and start the client.

packages/core/src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export async function activateCommon(
8989
// Setup the logger
9090
const toolkitOutputChannel = vscode.window.createOutputChannel('AWS Toolkit', { log: true })
9191
const toolkitLogChannel = vscode.window.createOutputChannel('AWS Toolkit Logs', { log: true })
92-
await activateLogger(context, contextPrefix, toolkitOutputChannel, toolkitLogChannel)
92+
await activateLogger(context, contextPrefix, toolkitLogChannel, toolkitOutputChannel)
9393
globals.outputChannel = toolkitOutputChannel
9494
globals.logOutputChannel = toolkitLogChannel
9595

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ import { isBeta } from '../vscode/env'
1717

1818
/**
1919
* Activate Logger functionality for the extension.
20+
*
21+
* @param outputChannel optional output channel for less granular logs
2022
*/
2123
export async function activate(
2224
extensionContext: vscode.ExtensionContext,
2325
contextPrefix: string,
24-
outputChannel: vscode.LogOutputChannel,
25-
logChannel: vscode.LogOutputChannel
26+
logChannel: vscode.LogOutputChannel,
27+
outputChannel?: vscode.LogOutputChannel
2628
): Promise<void> {
2729
const settings = Settings.instance.getSection('aws')
2830
const devLogfile = settings.get('dev.logfile', '')
@@ -52,7 +54,7 @@ export async function activate(
5254
setLogger(
5355
makeLogger({
5456
logLevel: chanLogLevel,
55-
outputChannels: [outputChannel, logChannel],
57+
outputChannels: outputChannel ? [outputChannel, logChannel] : [logChannel],
5658
useConsoleLog: true,
5759
}),
5860
'debugConsole'

0 commit comments

Comments
 (0)