mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-17 08:41:19 -07:00
feat(logging): Centralize debug logging with a dedicated utility (#11417)
This commit is contained in:
37
packages/core/src/utils/debugLogger.ts
Normal file
37
packages/core/src/utils/debugLogger.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @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();
|
||||
Reference in New Issue
Block a user