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

Function appendToLog

src/index.ts:127–140  ·  view source on GitHub ↗
(
  logPath: string,
  label: string,
  data?: unknown
)

Source from the content-addressed store, hash-verified

125}
126
127async function appendToLog(
128 logPath: string,
129 label: string,
130 data?: unknown
131): Promise<void> {
132 const timestamp = new Date().toISOString();
133 const line =
134 data !== undefined
135 ? `[${timestamp}] ${label} | ${JSON.stringify(data)}\n`
136 : `[${timestamp}] ${label}\n`;
137 const file = Bun.file(logPath);
138 const existing = (await file.exists()) ? await file.text() : "";
139 await Bun.write(logPath, existing + line);
140}
141
142const corsHeaders = {
143 "Access-Control-Allow-Origin": "*",

Callers 1

fetchFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected