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

Function attachErrorLogSink

src/utils/log.ts:109–134  ·  view source on GitHub ↗
(newSink: ErrorLogSink)

Source from the content-addressed store, hash-verified

107 * the default command) without coordination.
108 */
109export function attachErrorLogSink(newSink: ErrorLogSink): void {
110 if (errorLogSink !== null) {
111 return
112 }
113 errorLogSink = newSink
114
115 // Drain the queue immediately - errors should not be delayed
116 if (errorQueue.length > 0) {
117 const queuedEvents = [...errorQueue]
118 errorQueue.length = 0
119
120 for (const event of queuedEvents) {
121 switch (event.type) {
122 case 'error':
123 errorLogSink.logError(event.error)
124 break
125 case 'mcpError':
126 errorLogSink.logMCPError(event.serverName, event.error)
127 break
128 case 'mcpDebug':
129 errorLogSink.logMCPDebug(event.serverName, event.message)
130 break
131 }
132 }
133 }
134}
135
136/**
137 * Logs an error to multiple destinations for debugging and monitoring.

Callers 1

initializeErrorLogSinkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected