Skip to content

Commit

Permalink
fix(logs): noisy git output in logs #6192
Browse files Browse the repository at this point in the history
## Problem
Git commands are too noisy; running /review always opens Amazon Q output
channel with git command output

## Solution
- Output to the Amazon Q Logs channel instead
- Make it verbose level so it won't show by default
  • Loading branch information
ctlai95 authored Dec 10, 2024
1 parent 70a9295 commit 46e973f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "Code Review: Cleaned up output logs when running /review"
}
7 changes: 3 additions & 4 deletions packages/core/src/codewhisperer/util/gitUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { showOutputMessage } from '../../shared/utilities/messages'
import { getLogger, globals, removeAnsi } from '../../shared'
import { getLogger, removeAnsi } from '../../shared'
import { ChildProcess, ChildProcessOptions } from '../../shared/utilities/processUtils'
import { Uri } from 'vscode'

Expand All @@ -17,10 +16,10 @@ export async function isGitRepo(folder: Uri): Promise<boolean> {
rejectOnErrorCode: true,
onStdout: (text) => {
output += text
showOutputMessage(removeAnsi(text), globals.outputChannel)
getLogger().verbose(removeAnsi(text))
},
onStderr: (text) => {
showOutputMessage(removeAnsi(text), globals.outputChannel)
getLogger().error(removeAnsi(text))
},
spawnOptions: {
cwd: folder.fsPath,
Expand Down
11 changes: 5 additions & 6 deletions packages/core/src/codewhisperer/util/zipUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import {
} from '../models/errors'
import { ZipUseCase } from '../models/constants'
import { ChildProcess, ChildProcessOptions } from '../../shared/utilities/processUtils'
import { showOutputMessage } from '../../shared/utilities/messages'
import { globals, removeAnsi } from '../../shared'
import { removeAnsi } from '../../shared'

export interface ZipMetadata {
rootDir: string
Expand Down Expand Up @@ -303,10 +302,10 @@ export class ZipUtil {
rejectOnErrorCode: false,
onStdout: (text) => {
diffContent += text
showOutputMessage(removeAnsi(text), globals.outputChannel)
getLogger().verbose(removeAnsi(text))
},
onStderr: (text) => {
showOutputMessage(removeAnsi(text), globals.outputChannel)
getLogger().error(removeAnsi(text))
},
spawnOptions: {
cwd: projectPath,
Expand Down Expand Up @@ -340,10 +339,10 @@ export class ZipUtil {
rejectOnErrorCode: true,
onStdout: (text) => {
diffContent += text
showOutputMessage(removeAnsi(text), globals.outputChannel)
getLogger().verbose(removeAnsi(text))
},
onStderr: (text) => {
showOutputMessage(removeAnsi(text), globals.outputChannel)
getLogger().error(removeAnsi(text))
},
spawnOptions: {
cwd: projectPath,
Expand Down

0 comments on commit 46e973f

Please sign in to comment.