Ver código fonte

添加详细的mqtt错误日志

sw 1 dia atrás
pai
commit
eec62b8af0
1 arquivos alterados com 5 adições e 1 exclusões
  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) => {