From 692b861ee4994f17494f0f72d65d8bc3e676875c Mon Sep 17 00:00:00 2001 From: Andrey Goncharov Date: Mon, 27 Jun 2022 08:13:01 -0700 Subject: [PATCH] Increase verbosity of flipper server companion logging Summary: Log Flipper server companion requests and replies Reviewed By: passy Differential Revision: D37456027 fbshipit-source-id: 59ce3219b1f278237f1285e032272facdcf930e8 --- .../flipper-server-companion/src/companion.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/desktop/flipper-server-companion/src/companion.tsx b/desktop/flipper-server-companion/src/companion.tsx index 23203291a..47503498f 100644 --- a/desktop/flipper-server-companion/src/companion.tsx +++ b/desktop/flipper-server-companion/src/companion.tsx @@ -53,6 +53,9 @@ export class FlipperServerCompanion { for (const loadablePlugin of loadablePluginsArr) { this.loadablePlugins.set(loadablePlugin.id, loadablePlugin); } + console.debug(`[FlipperServerCompanion] constructor -> loadable plugins`, [ + ...this.loadablePlugins.keys(), + ]); } canHandleCommand(command: string): boolean { @@ -138,6 +141,10 @@ export class FlipperServerCompanion { ); await newClient.init(); + console.debug( + `[FlipperServerCompanion] createHeadlessClientIfNeeded -> new client created with plugins`, + [...newClient.sandyPluginStates.keys()], + ); this.clients.set(clientInfo.id, newClient); return newClient; @@ -161,6 +168,10 @@ export class FlipperServerCompanion { } const newDevice = new BaseDevice(this.flipperServer, deviceInfo); + console.debug( + `[FlipperServerCompanion] createHeadlessClientIfNeeded -> new device created with plugins`, + [...this.loadablePlugins.keys()], + ); this.devices.set(newDevice.serial, newDevice); return newDevice; } @@ -192,6 +203,7 @@ export class FlipperServerCompanion { ...args: any[] ): Promise { try { + console.debug(`[FlipperServerCompanion] command '${event}'`, ...args); const handler: (...args: any[]) => Promise = this.commandHandler[event]; if (!handler) { @@ -201,12 +213,10 @@ export class FlipperServerCompanion { ); } const result = await handler(...args); - console.debug(`[FlipperServerCompanion] command '${event}' - OK`); + console.debug(`[FlipperServerCompanion] command '${event}' - OK`, result); return result; } catch (e) { - console.debug( - `[FlipperServerCompanion] command '${event}' - ERROR: ${e} `, - ); + console.debug(`[FlipperServerCompanion] command '${event}' - ERROR`, e); throw e; } }