MCPcopy
hub / github.com/coder/mux / createLineBufferedLoggers

Function createLineBufferedLoggers

src/node/runtime/initHook.ts:177–191  ·  view source on GitHub ↗
(initLogger: InitLogger)

Source from the content-addressed store, hash-verified

175 * Returns an object with append and flush methods for each stream
176 */
177export function createLineBufferedLoggers(initLogger: InitLogger) {
178 const stdoutBuffer = new LineBuffer((line) => initLogger.logStdout(line));
179 const stderrBuffer = new LineBuffer((line) => initLogger.logStderr(line));
180
181 return {
182 stdout: {
183 append: (data: string) => stdoutBuffer.append(data),
184 flush: () => stdoutBuffer.flush(),
185 },
186 stderr: {
187 append: (data: string) => stderrBuffer.append(data),
188 flush: () => stderrBuffer.flush(),
189 },
190 };
191}
192
193/**
194 * Minimal runtime interface needed for running init hooks.

Callers 3

runInitHookFunction · 0.90
initHook.test.tsFile · 0.90
runInitHookOnRuntimeFunction · 0.85

Calls 4

appendMethod · 0.95
flushMethod · 0.95
logStdoutMethod · 0.80
logStderrMethod · 0.80

Tested by

no test coverage detected