Преглед на файлове

添加详细的mqtt错误日志

sw преди 1 ден
родител
ревизия
eec62b8af0
променени са 1 файла, в които са добавени 5 реда и са изтрити 1 реда
  1. 5 1
      src/domain/mqttServiceForDevice.ts

+ 5 - 1
src/domain/mqttServiceForDevice.ts

@@ -219,7 +219,11 @@ const startListening = () => {
   });
 
   mqttClient.on('error', (error) => {
-    console.log('[mqttServiceForDevice] 设备mqtt出现错误:', JSON.stringify(error));
+    console.error('[mqttServiceForDevice] 设备mqtt出现错误:', {
+      message: error.message,
+      code: error.code,
+      stack: error.stack
+    });
   });
 
   mqttClient.on('message', (topic, message) => {