(line: string)
| 283 | * shown as it is. |
| 284 | */ |
| 285 | export function uiLogLineText(line: string): string { |
| 286 | let parsed: unknown; |
| 287 | try { |
| 288 | parsed = JSON.parse(line); |
| 289 | } catch { |
| 290 | return line; |
| 291 | } |
| 292 | if (!isRecord(parsed)) { |
| 293 | return line; |
| 294 | } |
| 295 | const when = text(parsed['ts']).length > 0 ? text(parsed['ts']) : text(parsed['received']); |
| 296 | const level = text(parsed['level']); |
| 297 | const source = text(parsed['source']); |
| 298 | const message = text(parsed['message']); |
| 299 | const detail = text(parsed['detail']); |
| 300 | const head = [when, level, source.length > 0 ? `${source}:` : ''].filter((part) => part.length > 0).join(' '); |
| 301 | return `${head} ${message}${detail.length > 0 ? ` (${detail})` : ''}`.trim(); |
| 302 | } |
| 303 | |
| 304 | export interface ProcessReport { |
| 305 | selfPid: number; |
no test coverage detected