Export client logs for the active client as a part of the universal export
Summary: Design doc: https://docs.google.com/document/d/1HLCFl46RfqG0o1mSt8SWrwf_HMfOCRg_oENioc1rkvQ/edit# Introduce a command rto fetch debug data from the devices Reviewed By: passy Differential Revision: D40470838 fbshipit-source-id: 40a7ec66b1266ceff1b31b5b4f19b93765b78615
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ef0d9fb77e
commit
2db9bccf75
@@ -162,6 +162,12 @@ export interface FSStatsLike {
|
|||||||
birthtimeMs: number;
|
birthtimeMs: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface DeviceDebugData {
|
||||||
|
serial: string;
|
||||||
|
appId: string;
|
||||||
|
files: {path: string; data: string}[];
|
||||||
|
}
|
||||||
|
|
||||||
export type FlipperServerCommands = {
|
export type FlipperServerCommands = {
|
||||||
'get-server-state': () => Promise<{
|
'get-server-state': () => Promise<{
|
||||||
state: FlipperServerState;
|
state: FlipperServerState;
|
||||||
@@ -234,6 +240,7 @@ export type FlipperServerCommands = {
|
|||||||
) => Promise<boolean>;
|
) => Promise<boolean>;
|
||||||
'device-clear-logs': (serial: string) => Promise<void>;
|
'device-clear-logs': (serial: string) => Promise<void>;
|
||||||
'device-navigate': (serial: string, location: string) => Promise<void>;
|
'device-navigate': (serial: string, location: string) => Promise<void>;
|
||||||
|
'fetch-debug-data': () => Promise<DeviceDebugData[]>;
|
||||||
'metro-command': (serial: string, command: string) => Promise<void>;
|
'metro-command': (serial: string, command: string) => Promise<void>;
|
||||||
'client-list': () => Promise<ClientDescription[]>;
|
'client-list': () => Promise<ClientDescription[]>;
|
||||||
'client-find': (clientId: string) => Promise<ClientDescription | undefined>;
|
'client-find': (clientId: string) => Promise<ClientDescription | undefined>;
|
||||||
|
|||||||
@@ -419,6 +419,10 @@ export class FlipperServerImpl implements FlipperServer {
|
|||||||
'device-clear-logs': async (serial) => this.getDevice(serial).clearLogs(),
|
'device-clear-logs': async (serial) => this.getDevice(serial).clearLogs(),
|
||||||
'device-navigate': async (serial, loc) =>
|
'device-navigate': async (serial, loc) =>
|
||||||
this.getDevice(serial).navigateToLocation(loc),
|
this.getDevice(serial).navigateToLocation(loc),
|
||||||
|
'fetch-debug-data': async () => {
|
||||||
|
// TODO: Implement fetching client logs from all devices
|
||||||
|
return [];
|
||||||
|
},
|
||||||
'metro-command': async (serial: string, command: string) => {
|
'metro-command': async (serial: string, command: string) => {
|
||||||
const device = this.getDevice(serial);
|
const device = this.getDevice(serial);
|
||||||
if (!(device instanceof MetroDevice)) {
|
if (!(device instanceof MetroDevice)) {
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ import {
|
|||||||
showOpenDialog,
|
showOpenDialog,
|
||||||
startFileExport,
|
startFileExport,
|
||||||
startLinkExport,
|
startLinkExport,
|
||||||
startLogsExport,
|
startFlipperLogsExport,
|
||||||
} from '../utils/exportData';
|
} from '../utils/exportData';
|
||||||
import {openDeeplinkDialog} from '../deeplink';
|
import {openDeeplinkDialog} from '../deeplink';
|
||||||
import {css} from '@emotion/css';
|
import {css} from '@emotion/css';
|
||||||
@@ -229,7 +229,7 @@ function ExtrasMenu() {
|
|||||||
);
|
);
|
||||||
const startLogsExportTracked = useTrackedCallback(
|
const startLogsExportTracked = useTrackedCallback(
|
||||||
'Logs export',
|
'Logs export',
|
||||||
startLogsExport,
|
startFlipperLogsExport,
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
const startLinkExportTracked = useTrackedCallback(
|
const startLinkExportTracked = useTrackedCallback(
|
||||||
|
|||||||
@@ -605,13 +605,21 @@ export function canFileExport() {
|
|||||||
return !!getRenderHostInstance().showSaveDialog;
|
return !!getRenderHostInstance().showSaveDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function startLogsExport() {
|
export async function startFlipperLogsExport() {
|
||||||
const serializedLogs = exportLogs
|
const serializedLogs = exportLogs
|
||||||
.map((item) => JSON.stringify(item))
|
.map((item) => JSON.stringify(item))
|
||||||
.join('\n');
|
.join('\n');
|
||||||
await getRenderHostInstance().exportFile?.(serializedLogs);
|
await getRenderHostInstance().exportFile?.(serializedLogs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function startClientLogsExport() {
|
||||||
|
const _clientLogs = await getRenderHostInstance().flipperServer.exec(
|
||||||
|
'fetch-debug-data',
|
||||||
|
);
|
||||||
|
|
||||||
|
// TODO: Save all log files
|
||||||
|
}
|
||||||
|
|
||||||
export async function exportEverythingEverywhereAllAtOnce(
|
export async function exportEverythingEverywhereAllAtOnce(
|
||||||
store: MiddlewareAPI,
|
store: MiddlewareAPI,
|
||||||
) {
|
) {
|
||||||
@@ -619,10 +627,10 @@ export async function exportEverythingEverywhereAllAtOnce(
|
|||||||
// TODO: Pack all files in a single archive
|
// TODO: Pack all files in a single archive
|
||||||
|
|
||||||
// Step 1: Export Flipper logs
|
// Step 1: Export Flipper logs
|
||||||
await startLogsExport();
|
await startFlipperLogsExport();
|
||||||
|
|
||||||
// Step 2: Export device logs
|
// Step 2: Export device logs
|
||||||
// TODO: Implement me
|
await startClientLogsExport();
|
||||||
|
|
||||||
// Step 3: Export Flipper State
|
// Step 3: Export Flipper State
|
||||||
// TODO: Export all plugins automatically
|
// TODO: Export all plugins automatically
|
||||||
|
|||||||
Reference in New Issue
Block a user