refactor(insightCommand): replace console.error with logger for better error handling

This commit is contained in:
DragonnZhang 2026-02-09 20:34:53 +08:00
parent e66c203cb0
commit 4b95854e6c
4 changed files with 123 additions and 191 deletions

View file

@ -12,6 +12,9 @@ import { t } from '../../i18n/index.js';
import { join } from 'path';
import os from 'os';
import { StaticInsightGenerator } from '../../services/insight/generators/StaticInsightGenerator.js';
import { createDebugLogger } from '@qwen-code/qwen-code-core';
const logger = createDebugLogger('DataProcessor');
// Open file in default browser
async function openFileInBrowser(filePath: string): Promise<void> {
@ -118,7 +121,7 @@ export const insightCommand: SlashCommand = {
Date.now(),
);
} catch (browserError) {
console.error('Failed to open browser automatically:', browserError);
logger.error('Failed to open browser automatically:', browserError);
context.ui.addItem(
{
@ -149,7 +152,7 @@ export const insightCommand: SlashCommand = {
Date.now(),
);
console.error('Insight generation error:', error);
logger.error('Insight generation error:', error);
}
},
};