(id: string = runID)
| 4 | import { runID } from "./shared" |
| 5 | |
| 6 | function formatter(id: string = runID) { |
| 7 | return Logger.map(Logger.formatStructured, (output) => { |
| 8 | const messages = Array.isArray(output.message) ? output.message : [output.message] |
| 9 | return [ |
| 10 | ["timestamp", output.timestamp], |
| 11 | ["level", output.level], |
| 12 | ["run", id], |
| 13 | ...messages.flatMap((value) => (plain(value) ? flatten(value) : [["message", value] as const])), |
| 14 | ...(output.cause === undefined ? [] : [["cause", output.cause] as const]), |
| 15 | ...flatten(output.spans), |
| 16 | ...flatten(output.annotations), |
| 17 | ] |
| 18 | .map(([key, value]) => `${key}=${format(value)}`) |
| 19 | .join(" ") |
| 20 | }) |
| 21 | } |
| 22 | |
| 23 | function flatten( |
| 24 | input: Record<string, unknown>, |
no test coverage detected