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

Function logMCPErrorImpl

src/utils/errorLogSink.ts:179–195  ·  view source on GitHub ↗

* Implementation for logMCPError - writes MCP error to debug log and file.

(serverName: string, error: unknown)

Source from the content-addressed store, hash-verified

177 * Implementation for logMCPError - writes MCP error to debug log and file.
178 */
179function logMCPErrorImpl(serverName: string, error: unknown): void {
180 // Not themed, to avoid having to pipe theme all the way down
181 logForDebugging(`MCP server "${serverName}" ${error}`, { level: 'error' })
182
183 const logFile = getMCPLogsPath(serverName)
184 const errorStr =
185 error instanceof Error ? error.stack || error.message : String(error)
186
187 const errorInfo = {
188 error: errorStr,
189 timestamp: new Date().toISOString(),
190 sessionId: getSessionId(),
191 cwd: getFsImplementation().cwd(),
192 }
193
194 getLogWriter(logFile).write(errorInfo)
195}
196
197/**
198 * Implementation for logMCPDebug - writes MCP debug message to log file.

Callers

nothing calls this directly

Calls 6

logForDebuggingFunction · 0.85
getMCPLogsPathFunction · 0.85
getSessionIdFunction · 0.85
getFsImplementationFunction · 0.85
getLogWriterFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected