mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-04 22:51:08 +00:00
feat(core): migrate console calls to debugLogger (M3 Phase 6)
Migrate remaining console.* calls in packages/core utilities and services to use the structured DebugLogger pattern. This continues the Phase 6 migration work for utilities and helpers. Files migrated: - config/config.ts, core/client.ts, core/prompts.ts - core/anthropicContentGenerator, core/openaiContentGenerator - core/coreToolScheduler.ts, fallback/handler.ts - models/modelRegistry.ts, prompts/prompt-registry.ts - services/chatRecordingService.ts, sessionService.ts, loopDetectionService.ts - skills/skill-load.ts, skill-manager.ts - subagents/subagent.ts, subagent-manager.ts - utils: editor, environmentContext, fileUtils, getFolderStructure, installationManager, jsonl-utils, llm-edit-fixer, nextSpeakerChecker, openaiLogger, request-tokenizer/*, retry, ripgrepUtils, safeJsonParse, summarizer, systemEncoding, workspaceContext Remaining: utils/errorReporting.ts (13 calls)
This commit is contained in:
parent
78f6bd4d88
commit
45df0e8b82
34 changed files with 186 additions and 92 deletions
|
|
@ -2,6 +2,9 @@ import type { SkillConfig, SkillValidationResult } from './types.js';
|
|||
import * as fs from 'fs/promises';
|
||||
import * as path from 'path';
|
||||
import { parse as parseYaml } from '../utils/yaml-parser.js';
|
||||
import { createDebugLogger } from '../utils/debugLogger.js';
|
||||
|
||||
const debugLogger = createDebugLogger('SKILL_LOAD');
|
||||
|
||||
const SKILL_MANIFEST_FILE = 'SKILL.md';
|
||||
|
||||
|
|
@ -26,7 +29,7 @@ export async function loadSkillsFromDir(
|
|||
const config = parseSkillContent(content, skillManifest);
|
||||
skills.push(config);
|
||||
} catch (error) {
|
||||
console.warn(
|
||||
debugLogger.warn(
|
||||
`Failed to parse skill at ${skillDir}: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
||||
);
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ import type {
|
|||
import { SkillError, SkillErrorCode } from './types.js';
|
||||
import type { Config } from '../config/config.js';
|
||||
import { validateConfig } from './skill-load.js';
|
||||
import { createDebugLogger } from '../utils/debugLogger.js';
|
||||
|
||||
const debugLogger = createDebugLogger('SKILL_MANAGER');
|
||||
|
||||
const QWEN_CONFIG_DIR = '.qwen';
|
||||
const SKILLS_CONFIG_DIR = 'skills';
|
||||
|
|
@ -57,7 +60,7 @@ export class SkillManager {
|
|||
try {
|
||||
listener();
|
||||
} catch (error) {
|
||||
console.warn('Skill change listener threw an error:', error);
|
||||
debugLogger.warn('Skill change listener threw an error:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -214,7 +217,7 @@ export class SkillManager {
|
|||
stopWatching(): void {
|
||||
for (const watcher of this.watchers.values()) {
|
||||
void watcher.close().catch((error) => {
|
||||
console.warn('Failed to close skills watcher:', error);
|
||||
debugLogger.warn('Failed to close skills watcher:', error);
|
||||
});
|
||||
}
|
||||
this.watchers.clear();
|
||||
|
|
@ -426,7 +429,7 @@ export class SkillManager {
|
|||
// Skip directories without valid SKILL.md
|
||||
if (error instanceof SkillError) {
|
||||
// Parse error was already recorded
|
||||
console.warn(
|
||||
debugLogger.warn(
|
||||
`Failed to parse skill at ${skillDir}: ${error.message}`,
|
||||
);
|
||||
}
|
||||
|
|
@ -486,7 +489,7 @@ export class SkillManager {
|
|||
.get(existingPath)
|
||||
?.close()
|
||||
.catch((error) => {
|
||||
console.warn(
|
||||
debugLogger.warn(
|
||||
`Failed to close skills watcher for ${existingPath}:`,
|
||||
error,
|
||||
);
|
||||
|
|
@ -508,11 +511,11 @@ export class SkillManager {
|
|||
this.scheduleRefresh();
|
||||
})
|
||||
.on('error', (error) => {
|
||||
console.warn(`Skills watcher error for ${watchPath}:`, error);
|
||||
debugLogger.warn(`Skills watcher error for ${watchPath}:`, error);
|
||||
});
|
||||
this.watchers.set(watchPath, watcher);
|
||||
} catch (error) {
|
||||
console.warn(
|
||||
debugLogger.warn(
|
||||
`Failed to watch skills directory at ${watchPath}:`,
|
||||
error,
|
||||
);
|
||||
|
|
@ -536,7 +539,7 @@ export class SkillManager {
|
|||
try {
|
||||
await fs.mkdir(baseDir, { recursive: true });
|
||||
} catch (error) {
|
||||
console.warn(
|
||||
debugLogger.warn(
|
||||
`Failed to create user skills directory at ${baseDir}:`,
|
||||
error,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue