mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-26 13:04:49 -07:00
refactor: Replace console.error with structured logging and feedback (#12175)
This commit is contained in:
@@ -9,7 +9,7 @@ import path from 'node:path';
|
||||
import os, { EOL } from 'node:os';
|
||||
import crypto from 'node:crypto';
|
||||
import type { Config } from '../config/config.js';
|
||||
import type { AnyToolInvocation } from '../index.js';
|
||||
import { debugLogger, type AnyToolInvocation } from '../index.js';
|
||||
import { ToolErrorType } from './tool-error.js';
|
||||
import type {
|
||||
ToolInvocation,
|
||||
@@ -226,7 +226,7 @@ export class ShellToolInvocation extends BaseToolInvocation<
|
||||
.filter(Boolean);
|
||||
for (const line of pgrepLines) {
|
||||
if (!/^\d+$/.test(line)) {
|
||||
console.error(`pgrep: ${line}`);
|
||||
debugLogger.error(`pgrep: ${line}`);
|
||||
}
|
||||
const pid = Number(line);
|
||||
if (pid !== result.pid) {
|
||||
@@ -235,7 +235,7 @@ export class ShellToolInvocation extends BaseToolInvocation<
|
||||
}
|
||||
} else {
|
||||
if (!signal.aborted) {
|
||||
console.error('missing pgrep output');
|
||||
debugLogger.error('missing pgrep output');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -424,7 +424,7 @@ export class ShellTool extends BaseDeclarativeTool<
|
||||
const commandCheck = isCommandAllowed(params.command, this.config);
|
||||
if (!commandCheck.allowed) {
|
||||
if (!commandCheck.reason) {
|
||||
console.error(
|
||||
debugLogger.error(
|
||||
'Unexpected: isCommandAllowed returned false without a reason',
|
||||
);
|
||||
return `Command is not allowed: ${params.command}`;
|
||||
|
||||
Reference in New Issue
Block a user