MCPcopy Create free account
hub / github.com/garrytan/gstack / logTelemetry

Function logTelemetry

browse/src/telemetry.ts:65–74  ·  view source on GitHub ↗
(payload: TelemetryEvent)

Source from the content-addressed store, hash-verified

63
64/** Fire-and-forget log. Never throws. */
65export function logTelemetry(payload: TelemetryEvent): void {
66 if (isDisabled()) return;
67 const enriched = { ...payload, ts: new Date().toISOString() };
68 ensureDir()
69 .then(() => fs.appendFile(telemetryFile(), JSON.stringify(enriched) + '\n', 'utf8'))
70 .catch(() => {
71 // Telemetry must never crash the caller. If the disk is full or perms
72 // are wrong, swallow silently — there's nothing useful to do here.
73 });
74}
75
76/** Test-only: reset cached state. */
77export function _resetTelemetryCache(): void {

Callers 3

handleSaveFunction · 0.90
dispatchCdpCallFunction · 0.90
telemetry.test.tsFile · 0.85

Calls 3

isDisabledFunction · 0.85
telemetryFileFunction · 0.85
ensureDirFunction · 0.70

Tested by

no test coverage detected