MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / getLogWriter

Function getLogWriter

source code/utils/errorLogSink.ts:87–111  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

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

Callers 3

appendToLogFunction · 0.85
logMCPErrorImplFunction · 0.85
logMCPDebugImplFunction · 0.85

Calls 5

createJsonlWriterFunction · 0.85
getFsImplementationFunction · 0.85
registerCleanupFunction · 0.85
setMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected