Skip to content

Commit

Permalink
refactor(logs): drop "Amazon Q Logs" channel and just have "Amazon Q" (
Browse files Browse the repository at this point in the history
…aws#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]>
  • Loading branch information
nkomonen-amazon authored and karanA-aws committed Jan 17, 2025
1 parent 895839b commit 112db72
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
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 @@ -32,7 +32,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 @@ -228,6 +228,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,
}

// 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

0 comments on commit 112db72

Please sign in to comment.