Răsfoiți Sursa

Merge branch 'lang' into dev

lang 4 ani în urmă
părinte
comite
fba82fcbe0
2 a modificat fișierele cu 21 adăugiri și 6 ștergeri
  1. 15 0
      Ansjer/us_config/test_settings.py
  2. 6 6
      Controller/DeviceDebug.py

+ 15 - 0
Ansjer/us_config/test_settings.py

@@ -235,6 +235,15 @@ LOGGING = {
             'formatter': 'standard',
             'encoding': 'utf-8',
         },
+        'device_info': {
+            'level': 'INFO',
+            'class': 'logging.handlers.TimedRotatingFileHandler',
+            'filename': BASE_DIR + '/static/log/device_info/info.log',
+            'backupCount': 30,
+            'when': 'D',
+            'formatter': 'standard',
+            'encoding': 'utf-8',
+        },
     },
     'loggers': {
         'django': {
@@ -249,6 +258,12 @@ LOGGING = {
             'handlers': ['info'],
             'level':'INFO',
             'propagate': False
+        },
+
+        'device_info':{
+            'handlers': ['device_info'],
+            'level':'INFO',
+            'propagate': False
         }
         # 'django.db.backends': {
         #     'handlers': ['console'],

+ 6 - 6
Controller/DeviceDebug.py

@@ -58,11 +58,11 @@ class DeviceDebug(View):
 
     def single_debug(self,request, request_dict, uid, response):
         ip = CommonService.get_ip_address(request)
-        djangoLogger = logging.getLogger('info')
-        djangoLogger.info(strftime("%Y-%m-%d %H:%M:%S"))
-        djangoLogger.info("ip:"+ip)
-        djangoLogger.info("debug-----------------------start")
-        djangoLogger.info(request_dict.get('debug_log'))
-        djangoLogger.info("debug-----------------------end")
+        device_info = logging.getLogger('device_info')
+        device_info.info(strftime("%Y-%m-%d %H:%M:%S"))
+        device_info.info("ip:"+ip)
+        device_info.info("debug-----------------------start")
+        device_info.info(request_dict.get('debug_log'))
+        device_info.info("debug-----------------------end")
         return response.json(0,'debug success')
                 # return response.json(10, '生成失败')