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