MCPcopy
hub / github.com/codeaashu/claude-code / getLogWriter

Function getLogWriter

src/utils/errorLogSink.ts:85–109  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

83}
84
85function getLogWriter(path: string): JsonlWriter {
86 let writer = logWriters.get(path)
87 if (!writer) {
88 const dir = dirname(path)
89 writer = createJsonlWriter({
90 // sync IO: called from sync context
91 writeFn: (content: string) => {
92 try {
93 // Happy-path: directory already exists
94 getFsImplementation().appendFileSync(path, content)
95 } catch {
96 // If any error occurs, assume it was due to missing directory
97 getFsImplementation().mkdirSync(dir)
98 // Retry appending
99 getFsImplementation().appendFileSync(path, content)
100 }
101 },
102 flushIntervalMs: 1000,
103 maxBufferSize: 50,
104 })
105 logWriters.set(path, writer)
106 registerCleanup(async () => writer?.dispose())
107 }
108 return writer
109}
110
111function appendToLog(path: string, message: object): void {
112 if (process.env.USER_TYPE !== 'ant') {

Callers 3

appendToLogFunction · 0.85
logMCPErrorImplFunction · 0.85
logMCPDebugImplFunction · 0.85

Calls 6

createJsonlWriterFunction · 0.85
getFsImplementationFunction · 0.85
registerCleanupFunction · 0.85
getMethod · 0.65
disposeMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected