mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-27 21:44:25 -07:00
migrate console.error to coreEvents/debugger for sandbox, logger, chatRecordingService (#12253)
This commit is contained in:
@@ -15,6 +15,7 @@ import type {
|
||||
PartListUnion,
|
||||
GenerateContentResponseUsageMetadata,
|
||||
} from '@google/genai';
|
||||
import { debugLogger } from '../utils/debugLogger.js';
|
||||
|
||||
export const SESSION_FILE_PREFIX = 'session-';
|
||||
|
||||
@@ -170,7 +171,7 @@ export class ChatRecordingService {
|
||||
this.queuedThoughts = [];
|
||||
this.queuedTokens = null;
|
||||
} catch (error) {
|
||||
console.error('Error initializing chat recording service:', error);
|
||||
debugLogger.error('Error initializing chat recording service:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -222,7 +223,7 @@ export class ChatRecordingService {
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error saving message:', error);
|
||||
debugLogger.error('Error saving message to chat history.', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -239,7 +240,7 @@ export class ChatRecordingService {
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error saving thought:', error);
|
||||
debugLogger.error('Error saving thought to chat history.', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -273,7 +274,10 @@ export class ChatRecordingService {
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error updating message tokens:', error);
|
||||
debugLogger.error(
|
||||
'Error updating message tokens in chat history.',
|
||||
error,
|
||||
);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -367,7 +371,10 @@ export class ChatRecordingService {
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error adding tool call to message:', error);
|
||||
debugLogger.error(
|
||||
'Error adding tool call to message in chat history.',
|
||||
error,
|
||||
);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -381,7 +388,7 @@ export class ChatRecordingService {
|
||||
return JSON.parse(this.cachedLastConvData);
|
||||
} catch (error) {
|
||||
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {
|
||||
console.error('Error reading conversation file:', error);
|
||||
debugLogger.error('Error reading conversation file.', error);
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -413,7 +420,7 @@ export class ChatRecordingService {
|
||||
fs.writeFileSync(this.conversationFile, newContent);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error writing conversation file:', error);
|
||||
debugLogger.error('Error writing conversation file.', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -442,7 +449,7 @@ export class ChatRecordingService {
|
||||
const sessionPath = path.join(chatsDir, `${sessionId}.json`);
|
||||
fs.unlinkSync(sessionPath);
|
||||
} catch (error) {
|
||||
console.error('Error deleting session:', error);
|
||||
debugLogger.error('Error deleting session file.', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user