Migrate console to coreEvents.emitFeedback or debugLogger (#15219)

This commit is contained in:
Adib234
2025-12-29 15:46:10 -05:00
committed by GitHub
parent dcd2449b1a
commit 10ae84869a
66 changed files with 564 additions and 425 deletions
+1 -1
View File
@@ -1159,7 +1159,7 @@ describe('EditTool', () => {
result.returnDisplay.diffStat?.model_removed_lines,
);
} else if (result.error) {
console.error(`Edit failed for ${file.path}:`, result.error);
throw result.error;
}
}
-7
View File
@@ -277,9 +277,6 @@ class MemoryToolInvocation extends BaseToolInvocation<
} catch (error) {
const errorMessage =
error instanceof Error ? error.message : String(error);
console.warn(
`[MemoryTool] Error executing save_memory for fact "${fact}": ${errorMessage}`,
);
return {
llmContent: JSON.stringify({
success: false,
@@ -367,10 +364,6 @@ export class MemoryTool
await fsAdapter.writeFile(memoryFilePath, newContent, 'utf-8');
} catch (error) {
console.error(
`[MemoryTool] Error adding memory entry to ${memoryFilePath}:`,
error,
);
throw new Error(
`[MemoryTool] Failed to add memory entry: ${error instanceof Error ? error.message : String(error)}`,
);
+1 -1
View File
@@ -729,7 +729,7 @@ describe('SmartEditTool', () => {
result.returnDisplay.diffStat?.model_removed_lines,
);
} else if (result.error) {
console.error(`Edit failed for ${file.path}:`, result.error);
throw result.error;
}
}
+1 -1
View File
@@ -416,7 +416,7 @@ export class ToolRegistry {
);
}
} catch (e) {
console.error(`Tool discovery command "${discoveryCmd}" failed:`, e);
debugLogger.error(`Tool discovery command "${discoveryCmd}" failed:`, e);
throw e;
}
}
+2 -1
View File
@@ -14,6 +14,7 @@ import { ToolErrorType } from './tool-error.js';
import { getErrorMessage } from '../utils/errors.js';
import { type Config } from '../config/config.js';
import { getResponseText } from '../utils/partUtils.js';
import { debugLogger } from '../utils/debugLogger.js';
interface GroundingChunkWeb {
uri?: string;
@@ -167,7 +168,7 @@ class WebSearchToolInvocation extends BaseToolInvocation<
const errorMessage = `Error during web search for query "${
this.params.query
}": ${getErrorMessage(error)}`;
console.error(errorMessage, error);
debugLogger.warn(errorMessage, error);
return {
llmContent: `Error: ${errorMessage}`,
returnDisplay: `Error performing web search.`,
+2 -1
View File
@@ -44,6 +44,7 @@ import { FileOperation } from '../telemetry/metrics.js';
import { getSpecificMimeType } from '../utils/fileUtils.js';
import { getLanguageFromFilePath } from '../utils/language-detection.js';
import type { MessageBus } from '../confirmation-bus/message-bus.js';
import { debugLogger } from '../utils/debugLogger.js';
/**
* Parameters for the WriteFile tool
@@ -377,7 +378,7 @@ class WriteFileToolInvocation extends BaseToolInvocation<
// Include stack trace in debug mode for better troubleshooting
if (this.config.getDebugMode() && error.stack) {
console.error('Write file error stack:', error.stack);
debugLogger.error('Write file error stack:', error.stack);
}
} else if (error instanceof Error) {
errorMsg = `Error writing to file: ${error.message}`;