Files
gemini-cli/packages/core/src/utils/debugLogger.ts

38 lines
918 B
TypeScript

/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* A simple, centralized logger for developer-facing debug messages.
*
* WHY USE THIS?
* - It makes the INTENT of the log clear (it's for developers, not users).
* - It provides a single point of control for debug logging behavior.
* - We can lint against direct `console.*` usage to enforce this pattern.
*
* HOW IT WORKS:
* This is a thin wrapper around the native `console` object. The `ConsolePatcher`
* will intercept these calls and route them to the debug drawer UI.
*/
class DebugLogger {
log(...args: unknown[]): void {
console.log(...args);
}
warn(...args: unknown[]): void {
console.warn(...args);
}
error(...args: unknown[]): void {
console.error(...args);
}
debug(...args: unknown[]): void {
console.debug(...args);
}
}
export const debugLogger = new DebugLogger();