提交 71d5c572 编写于 作者: L LittleCoder

Adjust logging level [BR#210: binderclip]

上级 d41c0160
...@@ -27,7 +27,7 @@ def load_login(core): ...@@ -27,7 +27,7 @@ def load_login(core):
def login(self, enableCmdQR=False, picDir=None, qrCallback=None, def login(self, enableCmdQR=False, picDir=None, qrCallback=None,
loginCallback=None, exitCallback=None): loginCallback=None, exitCallback=None):
if self.alive: if self.alive:
logger.debug('itchat has already logged in.') logger.warning('itchat has already logged in.')
return return
while 1: while 1:
for getCount in range(10): for getCount in range(10):
...@@ -175,7 +175,7 @@ def web_init(self): ...@@ -175,7 +175,7 @@ def web_init(self):
self.storageClass.nickName = dic['User']['NickName'] self.storageClass.nickName = dic['User']['NickName']
# deal with contact list returned when init # deal with contact list returned when init
contactList = dic.get('ContactList', []) contactList = dic.get('ContactList', [])
contactList.append(self.loginInfo['User']) contactList.append(self.loginInfo['User']) # self contact should be added first
chatroomList, otherList = [], [] chatroomList, otherList = [], []
for m in contactList: for m in contactList:
if m['Sex'] != 0: if m['Sex'] != 0:
...@@ -233,7 +233,7 @@ def start_receiving(self, exitCallback=None, getReceivingFnOnly=False): ...@@ -233,7 +233,7 @@ def start_receiving(self, exitCallback=None, getReceivingFnOnly=False):
retryCount = 0 retryCount = 0
except: except:
retryCount += 1 retryCount += 1
logger.debug(traceback.format_exc()) logger.error(traceback.format_exc())
if self.receivingRetryCount < retryCount: if self.receivingRetryCount < retryCount:
self.alive = False self.alive = False
else: else:
......
...@@ -180,7 +180,7 @@ def produce_msg(core, msgList): ...@@ -180,7 +180,7 @@ def produce_msg(core, msgList):
'Type': 'Useless', 'Type': 'Useless',
'Text': 'UselessMsg', } 'Text': 'UselessMsg', }
else: else:
logger.debug('MsgType Unknown: %s\n%s' % (m['MsgType'], str(m))) logger.debug('Useless message received: %s\n%s' % (m['MsgType'], str(m)))
msg = { msg = {
'Type': 'Useless', 'Type': 'Useless',
'Text': 'UselessMsg', } 'Text': 'UselessMsg', }
......
...@@ -66,6 +66,7 @@ def configured_reply(self): ...@@ -66,6 +66,7 @@ def configured_reply(self):
r = replyFn(msg) r = replyFn(msg)
if r is not None: self.send(r, msg.get('FromUserName')) if r is not None: self.send(r, msg.get('FromUserName'))
except: except:
logger.warning('An error occurred in registered function, use `itchat.run(debug=True)` to show detailed information')
logger.debug(traceback.format_exc()) logger.debug(traceback.format_exc())
def msg_register(self, msgType, isFriendChat=False, isGroupChat=False, isMpChat=False): def msg_register(self, msgType, isFriendChat=False, isGroupChat=False, isMpChat=False):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册