(s: string)
| 35 | |
| 36 | /** Truncate a string for debug logging, collapsing newlines. */ |
| 37 | export function debugTruncate(s: string): string { |
| 38 | const flat = s.replace(/\n/g, '\\n') |
| 39 | if (flat.length <= DEBUG_MSG_LIMIT) { |
| 40 | return flat |
| 41 | } |
| 42 | return flat.slice(0, DEBUG_MSG_LIMIT) + `... (${flat.length} chars)` |
| 43 | } |
| 44 | |
| 45 | /** Truncate a JSON-serializable value for debug logging. */ |
| 46 | export function debugBody(data: unknown): string { |
no outgoing calls
no test coverage detected