Procházet zdrojové kódy

添加错误打印

lang před 3 roky
rodič
revize
7c7d41f29f
1 změnil soubory, kde provedl 6 přidání a 2 odebrání
  1. 6 2
      Controller/DetectControllerV2.py

+ 6 - 2
Controller/DetectControllerV2.py

@@ -179,6 +179,7 @@ class NotificationView(View):
                 if not have_dkey:
                     if push_type == 0:  # ios apns
                         do_apns_code = self.do_apns(**kwag_args)
+                        logger.info('do_apns_code===={}'.format(do_apns_code))
                     elif push_type == 1:  # android gcm
                         do_fcm_code = self.do_fcm(**kwag_args)
                     elif push_type == 2:  # android jpush
@@ -291,6 +292,8 @@ class NotificationView(View):
                 return JsonResponse(status=200, data=res_data)
         except Exception as e:
             logger.info('移动侦测接口异常: {}'.format(e))
+            logger.info('错误文件', e.__traceback__.tb_frame.f_globals['__file__'])
+            logger.info('错误行号', e.__traceback__.tb_lineno)
             return JsonResponse(status=500)
 
     def get_msg_title(self, appBundleId, nickname):
@@ -425,7 +428,7 @@ class NotificationView(View):
             n = apns2.Notification(payload=payload, priority=apns2.PRIORITY_LOW)
             res = cli.push(n=n, device_token=token_val, topic=appBundleId)
             print(res.status_code)
-            logger.info("推送状态:")
+            logger.info("apns_推送状态:")
             logger.info(res.status_code)
 
             #     200, 推送成功。
@@ -445,7 +448,8 @@ class NotificationView(View):
             return 'The program has a numeric format exception, one of the arithmetic exceptions'
         except Exception as e:
             print(repr(e))
-            logger.info(repr(e))
+            print('do_apns函数错误行号', e.__traceback__.tb_lineno)
+            logger.info('do_apns错误:{}'.format(repr(e)))
             return repr(e)
 
     def do_update_detect_interval(self, uid, channel, redisObject, detect_interval):