(line)
| 143 | let logReadStream = null; |
| 144 | |
| 145 | function enqueueLogLine(line) { |
| 146 | const entry = { timestamp: Date.now(), line }; |
| 147 | logBuffer.push(entry); |
| 148 | if (logBuffer.length > LOG_BUFFER_SIZE) logBuffer.shift(); |
| 149 | |
| 150 | for (const sub of logSubscribers) { |
| 151 | sub.queue.push(`data: ${JSON.stringify(entry)}\n\n`); |
| 152 | flushSubscriber(sub); |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | function flushSubscriber(sub) { |
| 157 | if (sub.draining || sub.closed) return; |
no test coverage detected