MCPcopy Create free account
hub / github.com/Noumena-Network/code / attachErrorLogSink

Function attachErrorLogSink

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

Source from the content-addressed store, hash-verified

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