MCPcopy Create free account
hub / github.com/microsoft/AI-Engineering-Coach / runtimeDebug

Function runtimeDebug

src/core/runtime-debug.ts:62–80  ·  view source on GitHub ↗
(scope: string, message: string, detail?: unknown)

Source from the content-addressed store, hash-verified

60}
61
62export function runtimeDebug(scope: string, message: string, detail?: unknown): void {
63 try {
64 ensureDebugDir();
65 const time = new Date().toISOString();
66 const suffix = detail === undefined ? '' : ` | ${detailToString(detail)}`;
67 const formatted = `${time} pid=${process.pid} [${scope}] ${message} | ${runtimeMemorySummary()}${suffix}`;
68 // Rotate log if it exceeds the size limit
69 try {
70 const stat = fs.statSync(DEBUG_LOG_FILE);
71 if (stat.size > MAX_LOG_SIZE) {
72 fs.truncateSync(DEBUG_LOG_FILE, 0);
73 }
74 } catch { /* file doesn't exist yet — that's fine */ }
75 fs.appendFileSync(DEBUG_LOG_FILE, formatted + '\n', 'utf-8');
76 if (outputHook) outputHook(formatted);
77 } catch {
78 // Best-effort only.
79 }
80}
81
82export function installRuntimeDebugHooks(scope = 'extension-host'): void {
83 const globalObj = globalThis as Record<string, unknown>;

Callers 15

activateFunction · 0.90
deactivateFunction · 0.90
processWorkspacesFunction · 0.90
logParseBreakdownFunction · 0.90
logParseWarningsFunction · 0.90
parseAllLogsViaWorkerFunction · 0.90
runChildAttemptFunction · 0.90
parse-worker.tsFile · 0.90
callLlmJsonFunction · 0.90
constructorMethod · 0.90
createOrShowMethod · 0.90

Calls 3

ensureDebugDirFunction · 0.85
runtimeMemorySummaryFunction · 0.85
detailToStringFunction · 0.70

Tested by

no test coverage detected