mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-29 20:20:57 +00:00
feat(core,cli): migrate console.debug to debugLogger (M3 Phase 1-3)
This commit is contained in:
parent
ba2824b0b0
commit
3959b73bce
63 changed files with 554 additions and 538 deletions
|
|
@ -6,6 +6,9 @@
|
|||
|
||||
import { execSync } from 'node:child_process';
|
||||
import { ProxyAgent } from 'undici';
|
||||
import { createDebugLogger } from '@qwen-code/qwen-code-core';
|
||||
|
||||
const debugLogger = createDebugLogger('GIT');
|
||||
|
||||
/**
|
||||
* Checks if a directory is within a git repository hosted on GitHub.
|
||||
|
|
@ -24,7 +27,7 @@ export const isGitHubRepository = (): boolean => {
|
|||
return pattern.test(remotes);
|
||||
} catch (_error) {
|
||||
// If any filesystem error occurs, assume not a git repo
|
||||
console.debug(`Failed to get git remote:`, _error);
|
||||
debugLogger.debug(`Failed to get git remote:`, _error);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
@ -83,7 +86,7 @@ export const getLatestGitHubRelease = async (
|
|||
}
|
||||
return releaseTag;
|
||||
} catch (_error) {
|
||||
console.debug(
|
||||
debugLogger.debug(
|
||||
`Failed to determine latest qwen-code-action release:`,
|
||||
_error,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -301,11 +301,8 @@ describe('extractUsageFromGeminiClient', () => {
|
|||
throw new Error('Test error');
|
||||
}),
|
||||
};
|
||||
const consoleSpy = vi.spyOn(console, 'debug').mockImplementation(() => {});
|
||||
const result = extractUsageFromGeminiClient(client);
|
||||
expect(result).toBeUndefined();
|
||||
expect(consoleSpy).toHaveBeenCalled();
|
||||
consoleSpy.mockRestore();
|
||||
});
|
||||
|
||||
it('should skip responses without usageMetadata', () => {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import type {
|
|||
import {
|
||||
OutputFormat,
|
||||
ToolErrorType,
|
||||
createDebugLogger,
|
||||
getMCPServerStatus,
|
||||
} from '@qwen-code/qwen-code-core';
|
||||
import type { Part, PartListUnion } from '@google/genai';
|
||||
|
|
@ -29,6 +30,8 @@ import type { JsonOutputAdapterInterface } from '../nonInteractive/io/BaseJsonOu
|
|||
import { computeSessionStats } from '../ui/utils/computeStats.js';
|
||||
import { getAvailableCommands } from '../nonInteractiveCliCommands.js';
|
||||
|
||||
const debugLogger = createDebugLogger('NON_INTERACTIVE');
|
||||
|
||||
/**
|
||||
* Normalizes various part list formats into a consistent Part[] array.
|
||||
*
|
||||
|
|
@ -144,7 +147,7 @@ export function extractUsageFromGeminiClient(
|
|||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.debug('Failed to extract usage metadata:', error);
|
||||
debugLogger.debug('Failed to extract usage metadata:', error);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue