fix(core): use debugLogger.debug for startup profiler logs (#15443)

This commit is contained in:
N. Taylor Mullen
2025-12-22 12:45:33 -08:00
committed by GitHub
parent b0d5c4c058
commit 0843d9af58
2 changed files with 17 additions and 3 deletions

View File

@@ -7,6 +7,7 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { StartupProfiler } from './startupProfiler.js';
import type { Config } from '../config/config.js';
import { debugLogger } from '../utils/debugLogger.js';
// Mock the metrics module
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', () => {

View File

@@ -145,7 +145,7 @@ export class StartupProfiler {
* Flushes buffered metrics to the telemetry system.
*/
flush(config: Config): void {
debugLogger.log(
debugLogger.debug(
'[STARTUP] StartupProfiler.flush() called with',
this.phases.size,
'phases',
@@ -181,7 +181,7 @@ export class StartupProfiler {
...phase.details,
};
debugLogger.log(
debugLogger.debug(
'[STARTUP] Recording metric for phase:',
phase.name,
'duration:',
@@ -192,7 +192,7 @@ export class StartupProfiler {
details,
});
} else {
debugLogger.log(
debugLogger.debug(
'[STARTUP] Skipping phase without measure:',
phase.name,
);