mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-11 14:40:52 -07:00
fix(core): use debugLogger.debug for startup profiler logs (#15443)
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||||
import { StartupProfiler } from './startupProfiler.js';
|
import { StartupProfiler } from './startupProfiler.js';
|
||||||
import type { Config } from '../config/config.js';
|
import type { Config } from '../config/config.js';
|
||||||
|
import { debugLogger } from '../utils/debugLogger.js';
|
||||||
|
|
||||||
// Mock the metrics module
|
// Mock the metrics module
|
||||||
vi.mock('./metrics.js', () => ({
|
vi.mock('./metrics.js', () => ({
|
||||||
@@ -255,6 +256,19 @@ describe('StartupProfiler', () => {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should use debug logging instead of standard logging', () => {
|
||||||
|
const logSpy = vi.spyOn(debugLogger, 'log');
|
||||||
|
const debugSpy = vi.spyOn(debugLogger, 'debug');
|
||||||
|
|
||||||
|
const handle = profiler.start('test_phase');
|
||||||
|
handle?.end();
|
||||||
|
|
||||||
|
profiler.flush(mockConfig);
|
||||||
|
|
||||||
|
expect(logSpy).not.toHaveBeenCalled();
|
||||||
|
expect(debugSpy).toHaveBeenCalled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('integration scenarios', () => {
|
describe('integration scenarios', () => {
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ export class StartupProfiler {
|
|||||||
* Flushes buffered metrics to the telemetry system.
|
* Flushes buffered metrics to the telemetry system.
|
||||||
*/
|
*/
|
||||||
flush(config: Config): void {
|
flush(config: Config): void {
|
||||||
debugLogger.log(
|
debugLogger.debug(
|
||||||
'[STARTUP] StartupProfiler.flush() called with',
|
'[STARTUP] StartupProfiler.flush() called with',
|
||||||
this.phases.size,
|
this.phases.size,
|
||||||
'phases',
|
'phases',
|
||||||
@@ -181,7 +181,7 @@ export class StartupProfiler {
|
|||||||
...phase.details,
|
...phase.details,
|
||||||
};
|
};
|
||||||
|
|
||||||
debugLogger.log(
|
debugLogger.debug(
|
||||||
'[STARTUP] Recording metric for phase:',
|
'[STARTUP] Recording metric for phase:',
|
||||||
phase.name,
|
phase.name,
|
||||||
'duration:',
|
'duration:',
|
||||||
@@ -192,7 +192,7 @@ export class StartupProfiler {
|
|||||||
details,
|
details,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
debugLogger.log(
|
debugLogger.debug(
|
||||||
'[STARTUP] Skipping phase without measure:',
|
'[STARTUP] Skipping phase without measure:',
|
||||||
phase.name,
|
phase.name,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user