(
location: string,
message: string,
data?: DebugProbeData,
options: DebugProbeOptions = {}
)
| 29 | } |
| 30 | |
| 31 | export function sendDebugProbe( |
| 32 | location: string, |
| 33 | message: string, |
| 34 | data?: DebugProbeData, |
| 35 | options: DebugProbeOptions = {} |
| 36 | ): void { |
| 37 | const serializedData = data |
| 38 | ? Object.fromEntries( |
| 39 | Object.entries(data).map(([key, value]) => [key, serializeProbeValue(value)]) |
| 40 | ) |
| 41 | : undefined; |
| 42 | |
| 43 | const payload: Record<string, unknown> = { |
| 44 | location, |
| 45 | ...(serializedData ?? {}), |
| 46 | }; |
| 47 | |
| 48 | if ( |
| 49 | options.startedAt !== undefined && |
| 50 | typeof payload.durationMs !== 'number' |
| 51 | ) { |
| 52 | logElapsed(log, message, options.startedAt, { |
| 53 | level: options.level ?? 'debug', |
| 54 | data: payload, |
| 55 | }); |
| 56 | return; |
| 57 | } |
| 58 | |
| 59 | logWithLevel(log, options.level ?? 'debug', message, payload); |
| 60 | } |
no test coverage detected