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
+2 -1
View File
@@ -43,6 +43,7 @@ import { templateString } from './utils.js';
import { parseThought } from '../utils/thoughtUtils.js';
import { type z } from 'zod';
import { zodToJsonSchema } from 'zod-to-json-schema';
import { debugLogger } from '../utils/debugLogger.js';
/** A callback function to report on agent activity. */
export type ActivityCallback = (activity: SubagentActivityEvent) => void;
@@ -506,7 +507,7 @@ export class AgentExecutor<TOutput extends z.ZodTypeAny> {
if (!allowedToolNames.has(functionCall.name as string)) {
const error = `Unauthorized tool call: '${functionCall.name}' is not available to this agent.`;
console.warn(`[AgentExecutor] Blocked call: ${error}`);
debugLogger.warn(`[AgentExecutor] Blocked call: ${error}`);
syncResponseParts.push({
functionResponse: {
+4 -3
View File
@@ -8,6 +8,7 @@ import type { Config } from '../config/config.js';
import type { AgentDefinition } from './types.js';
import { CodebaseInvestigatorAgent } from './codebase-investigator.js';
import { type z } from 'zod';
import { debugLogger } from '../utils/debugLogger.js';
/**
* Manages the discovery, loading, validation, and registration of
@@ -26,7 +27,7 @@ export class AgentRegistry {
this.loadBuiltInAgents();
if (this.config.getDebugMode()) {
console.log(
debugLogger.log(
`[AgentRegistry] Initialized with ${this.agents.size} agents.`,
);
}
@@ -72,14 +73,14 @@ export class AgentRegistry {
): void {
// Basic validation
if (!definition.name || !definition.description) {
console.warn(
debugLogger.warn(
`[AgentRegistry] Skipping invalid agent definition. Missing name or description.`,
);
return;
}
if (this.agents.has(definition.name) && this.config.getDebugMode()) {
console.log(`[AgentRegistry] Overriding agent '${definition.name}'`);
debugLogger.log(`[AgentRegistry] Overriding agent '${definition.name}'`);
}
this.agents.set(definition.name, definition);