| 598 | } |
| 599 | |
| 600 | async log<T extends boolean = false>(options?: { includeArgs?: T }) { |
| 601 | return this.startChain( |
| 602 | () => |
| 603 | options?.includeArgs |
| 604 | ? Promise.all(pageLogs) |
| 605 | : Promise.all(pageLogs).then((logs) => |
| 606 | logs.map(({ source, message }) => ({ source, message })) |
| 607 | ) |
| 608 | // TODO: Starting with TypeScript 5.8 we might not need this type cast. |
| 609 | ) as Promise< |
| 610 | T extends true |
| 611 | ? { source: string; message: string; args: unknown[] }[] |
| 612 | : { source: string; message: string }[] |
| 613 | > |
| 614 | } |
| 615 | |
| 616 | async websocketFrames() { |
| 617 | return this.startChain(() => websocketFrames) |