Add the debug packet recorder behind the developer-tools toggle.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user