From 5800c599481b4140ac0dc5d8b50b930f156482ac Mon Sep 17 00:00:00 2001 From: Lei PAN Date: Sat, 22 Apr 2023 10:18:44 +0200 Subject: [PATCH] add logWithDevice method --- src/workers/CommandorPage.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/workers/CommandorPage.js b/src/workers/CommandorPage.js index bbc32c9..e22feef 100644 --- a/src/workers/CommandorPage.js +++ b/src/workers/CommandorPage.js @@ -60,6 +60,10 @@ function log(message) { appointmentLogger.log({level: "info", message: message}) } +function logWithDevice(message, device) { + appointmentLogger.log({level: "info", device: device.model(), message: message}) +} + class CommandorPage { constructor(contact, device, mongoManager, selectedStore = DEFAULT_STORE, audioAnalyse = false, alertBeep = false) { this.contact = contact; @@ -374,7 +378,10 @@ class CommandorPage { shell.beep() } } - log("发现datadome"); + logWithDevice("发现datadome", this.device); + } else if (content.includes("502 Bad Gateway")) { + logWithDevice("502 Bad Gateway found", this.device) + await this.page.reload() } else if (currentPage.url().includes("sorry")) { await this.resetBrowser() } else {