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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Feature",
"description": "Amazon Q: Simplify log channel"
}
4 changes: 1 addition & 3 deletions packages/amazonq/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,8 @@ export async function activateAmazonQCommon(context: vscode.ExtensionContext, is
globals.manifestPaths.endpoints = context.asAbsolutePath(join('resources', 'endpoints.json'))
globals.regionProvider = RegionProvider.fromEndpointsProvider(makeEndpointsProvider())

const qOutputChannel = vscode.window.createOutputChannel('Amazon Q', { log: true })
const qLogChannel = vscode.window.createOutputChannel('Amazon Q Logs', { log: true })
await activateLogger(context, amazonQContextPrefix, qOutputChannel, qLogChannel)
globals.outputChannel = qOutputChannel
await activateLogger(context, amazonQContextPrefix, qLogChannel)
globals.logOutputChannel = qLogChannel
globals.loginManager = new LoginManager(globals.awsContext, new CredentialsStore())

Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/amazonq/lsp/lspClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
} from './types'
import { Writable } from 'stream'
import { CodeWhispererSettings } from '../../codewhisperer/util/codewhispererSettings'
import { fs, getLogger } from '../../shared'
import { fs, getLogger, globals } from '../../shared'

const localize = nls.loadMessageBundle()

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

}

// Create the language client and start the client.
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export async function activateCommon(
// Setup the logger
const toolkitOutputChannel = vscode.window.createOutputChannel('AWS Toolkit', { log: true })
const toolkitLogChannel = vscode.window.createOutputChannel('AWS Toolkit Logs', { log: true })
await activateLogger(context, contextPrefix, toolkitOutputChannel, toolkitLogChannel)
await activateLogger(context, contextPrefix, toolkitLogChannel, toolkitOutputChannel)
globals.outputChannel = toolkitOutputChannel
globals.logOutputChannel = toolkitLogChannel

Expand Down
8 changes: 5 additions & 3 deletions packages/core/src/shared/logger/activation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ import { isBeta } from '../vscode/env'

/**
* Activate Logger functionality for the extension.
*
* @param outputChannel optional output channel for less granular logs
*/
export async function activate(
extensionContext: vscode.ExtensionContext,
contextPrefix: string,
outputChannel: vscode.LogOutputChannel,
logChannel: vscode.LogOutputChannel
logChannel: vscode.LogOutputChannel,
outputChannel?: vscode.LogOutputChannel
): Promise<void> {
const settings = Settings.instance.getSection('aws')
const devLogfile = settings.get('dev.logfile', '')
Expand Down Expand Up @@ -52,7 +54,7 @@ export async function activate(
setLogger(
makeLogger({
logLevel: chanLogLevel,
outputChannels: [outputChannel, logChannel],
outputChannels: outputChannel ? [outputChannel, logChannel] : [logChannel],
useConsoleLog: true,
}),
'debugConsole'
Expand Down
Loading