Kaynağa Gözat

去除非 Debug 模式下的调试信息

James Iter 8 yıl önce
ebeveyn
işleme
c66861f419
4 değiştirilmiş dosya ile 12 ekleme ve 5 silme
  1. 1 1
      docs/todo.md
  2. 1 1
      models/database.py
  3. 4 1
      models/event_processor.py
  4. 6 2
      models/initialize.py

+ 1 - 1
docs/todo.md

@@ -43,8 +43,8 @@
 - [ ] 制作适用于 JimV 的 Windows 2012 模板镜像
 - [x] 制作模板镜像的 BT 链接,并展现到模板镜像的下载页面
 - [x] 解决数据库重连隐患(当数据库[MySQL|Redis]重启后)
+- [x] 去除非 Debug 模式下的调试信息
 - [ ] 考虑开辟一个单独的消息处理线程。所有业务消息都塞到进程中的队列内,由该线程统一处理。这样可以更好的处理数据库重连问题。
-- [ ] 去除非 Debug 模式下的调试信息
 - [ ] 实现 CentOS 7 单机版一建安装脚本(包括全新的数据库安装、配置、部署)
 - [ ] 实现磁盘联动机制。即当删除宿主机时,相随的所有磁盘一并删除
 - [ ] 融入 Systemd

+ 1 - 1
models/database.py

@@ -49,7 +49,7 @@ class Database(object):
             else:
                 e_msg = err.msg
 
-            print(e_msg)
+            logger.error(e_msg)
             exit(err.errno)
 
     @classmethod

+ 4 - 1
models/event_processor.py

@@ -325,7 +325,10 @@ class EventProcessor(object):
     def launch(cls):
         while True:
             if Utils.exit_flag:
-                print 'Thread EventProcessor say bye-bye'
+                msg = 'Thread EventProcessor say bye-bye'
+                print msg
+                logger.info(msg=msg)
+
                 return
 
             try:

+ 6 - 2
models/initialize.py

@@ -137,7 +137,9 @@ class Init(object):
         while True:
             try:
                 if Utils.exit_flag:
-                    print 'Thread pub_sub_ping_pong say bye-bye'
+                    msg = 'Thread pub_sub_ping_pong say bye-bye'
+                    print msg
+                    logger.info(msg=msg)
                     return
 
                 time.sleep(10)
@@ -157,7 +159,9 @@ class Init(object):
         while True:
             try:
                 if Utils.exit_flag:
-                    print 'Thread clear_expire_monitor_log say bye-bye'
+                    msg = 'Thread clear_expire_monitor_log say bye-bye'
+                    print msg
+                    logger.info(msg=msg)
                     return
 
                 time.sleep(10)