1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 17:23:37 +00:00

Improve desktop IPC logging (#11864)

* Improve desktop IPC logging

* Log error

* Force file to only log info, like the desktop app does

* use ?
This commit is contained in:
Daniel García
2024-11-14 17:45:19 +01:00
committed by GitHub
parent ef127fd26e
commit d0f24dc41f
5 changed files with 38 additions and 6 deletions

View File

@@ -93,11 +93,23 @@ export class NativeMessagingMain {
break;
}
case ipc.IpcMessageType.Message:
this.windowMain.win.webContents.send("nativeMessaging", JSON.parse(msg.message));
try {
const msgJson = JSON.parse(msg.message);
this.logService.debug("Native messaging message:", msgJson);
this.windowMain.win?.webContents.send("nativeMessaging", msgJson);
} catch (e) {
this.logService.warning("Error processing message:", e, msg.message);
}
break;
default:
this.logService.warning("Unknown message type:", msg.kind, msg.message);
break;
}
});
this.logService.info("Native messaging server started at:", this.ipcServer.getPath());
ipcMain.on("nativeMessagingReply", (event, msg) => {
if (msg != null) {
this.send(msg);
@@ -110,6 +122,7 @@ export class NativeMessagingMain {
}
send(message: object) {
this.logService.debug("Native messaging reply:", message);
this.ipcServer?.send(JSON.stringify(message));
}