MCPcopy Index your code
hub / github.com/MrgSub/opencode-debug / appendToLog

Function appendToLog

example/standalone-server.ts:14–23  ·  view source on GitHub ↗
(label: string, data?: unknown)

Source from the content-addressed store, hash-verified

12await mkdir(".opencode", { recursive: true });
13
14async function appendToLog(label: string, data?: unknown): Promise<void> {
15 const timestamp = new Date().toISOString();
16 const line = data !== undefined
17 ? `[${timestamp}] ${label} | ${JSON.stringify(data)}\n`
18 : `[${timestamp}] ${label}\n`;
19
20 const file = Bun.file(LOG_FILE);
21 const existing = (await file.exists()) ? await file.text() : "";
22 await Bun.write(LOG_FILE, existing + line);
23}
24
25const corsHeaders = {
26 "Access-Control-Allow-Origin": "*",

Callers 1

fetchFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected