From fa4e4791a2cc36a321fea032d73ff007980a315f Mon Sep 17 00:00:00 2001 From: JovannMC Date: Sun, 7 Jul 2024 23:00:44 +0300 Subject: [PATCH] Small logging updates --- src/HaritoraX.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/HaritoraX.ts b/src/HaritoraX.ts index 8d19801..981cd8f 100644 --- a/src/HaritoraX.ts +++ b/src/HaritoraX.ts @@ -292,11 +292,9 @@ export default class HaritoraX extends EventEmitter { * @example * device.startConnection("COM"); **/ - startConnection(connectionMode: string, portNames?: string[], heartbeatInterval: number = 10000): boolean { - if (!isConnectionModeSupported(connectionMode)) { - error(`Connection mode ${connectionMode} not supported for ${trackerModelEnabled}`); - return; - } + startConnection(connectionMode: string, portNames?: string[], heartbeatInterval: number = 10000) { + if (!isConnectionModeSupported(connectionMode)) + error(`${connectionMode} connection not supported for ${trackerModelEnabled}`, true); if (connectionMode === "com") { com = new COM(trackerModelEnabled, heartbeatInterval); @@ -741,7 +739,7 @@ export default class HaritoraX extends EventEmitter { try { await bluetooth.read(trackerName, trackerService, magnetometerCharacteristic); } catch (err) { - error(`Error reading magnetometer status: ${err}`); + error(`Error reading mag status: ${err}`); return null; } } @@ -1436,7 +1434,7 @@ function processBatteryData(data: string, trackerName: string) { logBatteryInfo(batteryData[0], batteryData[1], batteryData[2]); } catch (err) { error(`Error parsing battery data JSON for ${trackerName}: ${err}`); - error(`Raw battery data: ${data}`); + log(`Raw battery data: ${data}`); } } else if (trackerModelEnabled === "wireless" && isWirelessBT(trackerName) && bluetoothEnabled) { try {