(value: unknown, kind: string)
| 5 | export type Arguments = any[]; |
| 6 | |
| 7 | function valueToLogString(value: unknown, kind: string): string { |
| 8 | if (Array.isArray(value)) { |
| 9 | return value.map((item) => valueToLogString(item, kind)).join(', '); |
| 10 | } |
| 11 | if (value === undefined) { |
| 12 | return 'undefined'; |
| 13 | } |
| 14 | if (value === null) { |
| 15 | return 'null'; |
| 16 | } |
| 17 | try { |
| 18 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 19 | if (value && (value as any).path) { |
| 20 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 21 | return `<Uri:${(value as any).path}>`; |
| 22 | } |
| 23 | return JSON.stringify(value); |
| 24 | } catch { |
| 25 | return `<${kind} cannot be serialized for logging>`; |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | // Convert the given array of values (func call arguments) into a string |
| 30 | // suitable to be used in a log message. |
no test coverage detected