26 lines
532 B
TypeScript
26 lines
532 B
TypeScript
export interface DebugPacket {
|
|
id: number;
|
|
ts: number;
|
|
phase: 'start' | 'end';
|
|
method: string;
|
|
url: string;
|
|
path: string;
|
|
status?: number;
|
|
ms?: number;
|
|
txnId?: string;
|
|
eventId?: string;
|
|
req?: string;
|
|
res?: string;
|
|
error?: string;
|
|
}
|
|
|
|
let nextId = 0;
|
|
|
|
export function recordPacket(packet: Omit<DebugPacket, 'id'>) {
|
|
const full: DebugPacket = { id: nextId, ...packet };
|
|
nextId += 1;
|
|
|
|
// Web and mobile builds have no electron bridge, so nothing is recorded there
|
|
window.electron?.debug?.send(full);
|
|
}
|