MCPcopy Create free account
hub / github.com/cortexkit/magic-context / flush

Function flush

packages/plugin/src/shared/logger.ts:31–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29}
30
31function flush(): void {
32 if (flushTimer) {
33 clearTimeout(flushTimer);
34 flushTimer = null;
35 }
36 if (buffer.length === 0) return;
37 const data = buffer.join("");
38 buffer = [];
39 try {
40 const logFile = getMagicContextLogPath();
41 ensureDir(logFile);
42 fs.appendFileSync(logFile, data);
43 } catch {
44 // Intentional: logging must never throw
45 }
46}
47
48function scheduleFlush(): void {
49 if (flushTimer) return;

Callers 2

scheduleFlushFunction · 0.70
logFunction · 0.70

Calls 2

getMagicContextLogPathFunction · 0.90
ensureDirFunction · 0.70

Tested by

no test coverage detected