Ver código fonte

推送接口添加错误log

lang 3 anos atrás
pai
commit
acc892e6f6
1 arquivos alterados com 4 adições e 0 exclusões
  1. 4 0
      Controller/DetectControllerV2.py

+ 4 - 0
Controller/DetectControllerV2.py

@@ -414,9 +414,11 @@ class NotificationView(View):
         #     return
 
     def do_fcm(self, uid, channel, appBundleId, token_val, event_type, n_time, msg_title, msg_text):
+        logger = logging.getLogger('info')
         try:
             serverKey = FCM_CONFIG[appBundleId]
         except Exception as e:
+            logger.info('------fcm_error:{}'.format(repr(e)))
             return 'serverKey abnormal'
         push_service = FCMNotification(api_key=serverKey)
         data = {"alert": "Motion ", "event_time": n_time, "event_type": event_type, "msg": "",
@@ -428,6 +430,8 @@ class NotificationView(View):
                                                        'default_sound': True,
                                                        'default_light_settings': True
                                                    })
+        logger.info('------fcm_status:')
+        logger.info(result)
         print('fcm push ing')
         print(result)
         return result