* Parses a single mcp-scripts log line * Expected format: [timestamp] [server-name] message * @param {string} line - Log line to parse * @returns {Object|null} Parsed log entry or null if invalid
(line)
| 76 | * @returns {Object|null} Parsed log entry or null if invalid |
| 77 | */ |
| 78 | function parseMCPScriptsLogLine(line) { |
| 79 | // Match format: [timestamp] [server-name] message |
| 80 | const match = line.match(/^\[([^\]]+)\]\s+\[([^\]]+)\]\s+(.+)$/); |
| 81 | |
| 82 | if (!match) { |
| 83 | // Return unparsed line as-is for display |
| 84 | return { |
| 85 | timestamp: null, |
| 86 | serverName: null, |
| 87 | message: line.trim(), |
| 88 | raw: true, |
| 89 | }; |
| 90 | } |
| 91 | |
| 92 | const [, timestamp, serverName, message] = match; |
| 93 | |
| 94 | return { |
| 95 | timestamp: timestamp.trim(), |
| 96 | serverName: serverName.trim(), |
| 97 | message: message.trim(), |
| 98 | raw: false, |
| 99 | }; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Generates a lightweight plain text summary optimized for console output. |
no outgoing calls
no test coverage detected