refactor(logging): Centralize console logging with debugLogger (#11590)

This commit is contained in:
Abhi
2025-10-21 16:35:22 -04:00
committed by GitHub
parent f5e07d94bd
commit b364f37655
72 changed files with 345 additions and 289 deletions

View File

@@ -4,6 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { debugLogger } from '@google/gemini-cli-core';
import type { SpawnOptions } from 'node:child_process';
import { spawn } from 'node:child_process';
@@ -165,7 +166,7 @@ export const getUrlOpenCommand = (): string => {
default:
// Default to xdg-open, which appears to be supported for the less popular operating systems.
openCmd = 'xdg-open';
console.warn(
debugLogger.warn(
`Unknown platform: ${process.platform}. Attempting to open URLs with: ${openCmd}.`,
);
break;

View File

@@ -30,6 +30,7 @@ import { exec } from 'node:child_process';
import { promisify } from 'node:util';
import { isKittyProtocolEnabled } from './kittyProtocolDetector.js';
import { VSCODE_SHIFT_ENTER_SEQUENCE } from './platformConstants.js';
import { debugLogger } from '@google/gemini-cli-core';
const execAsync = promisify(exec);
@@ -88,7 +89,7 @@ async function detectTerminal(): Promise<SupportedTerminal | null> {
return 'vscode';
} catch (error) {
// Continue detection even if process check fails
console.debug('Parent process detection failed:', error);
debugLogger.debug('Parent process detection failed:', error);
}
}
@@ -103,7 +104,7 @@ async function backupFile(filePath: string): Promise<void> {
await fs.copyFile(filePath, backupPath);
} catch (error) {
// Log backup errors but continue with operation
console.warn(`Failed to create backup of ${filePath}:`, error);
debugLogger.warn(`Failed to create backup of ${filePath}:`, error);
}
}

View File

@@ -9,6 +9,7 @@ import updateNotifier from 'update-notifier';
import semver from 'semver';
import { getPackageJson } from '../../utils/package.js';
import type { LoadedSettings } from '../../config/settings.js';
import { debugLogger } from '@google/gemini-cli-core';
export const FETCH_TIMEOUT_MS = 2000;
@@ -101,7 +102,7 @@ export async function checkForUpdates(
return null;
} catch (e) {
console.warn('Failed to check for updates: ' + e);
debugLogger.warn('Failed to check for updates: ' + e);
return null;
}
}