(tid, state, events)
| 231 | } |
| 232 | |
| 233 | function drainEvents(tid, state, events) { |
| 234 | let parsed; |
| 235 | try { parsed = Stalker.parse(events, { annotate: true, stringify: false }); } |
| 236 | catch (e) { return; } |
| 237 | const lines = []; |
| 238 | for (const ev of parsed) { |
| 239 | if (state.count >= CONFIG.maxEventsPerCall) break; |
| 240 | const line = formatEvent(state, ev); |
| 241 | if (line == null) continue; |
| 242 | state.count++; |
| 243 | if (lines.length < CONFIG.flushBatch) lines.push(line); |
| 244 | else state.dropped++; |
| 245 | } |
| 246 | if (lines.length) { |
| 247 | const tag = `${C.dim}#${tid}${C.reset}`; |
| 248 | console.log(lines.map((l) => `${tag} ${l}`).join("\n")); |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | function sym(addr) { return CONFIG.symbolicate ? resolve(addr).text : addr.toString(); } |
| 253 |
no test coverage detected