From 71d5c5722a9feaaab622ef9fd7a4b66465bd9275 Mon Sep 17 00:00:00 2001 From: LittleCoder Date: Mon, 23 Jan 2017 19:04:14 +0800 Subject: [PATCH] Adjust logging level [BR#210: binderclip] --- itchat/components/login.py | 6 +++--- itchat/components/messages.py | 2 +- itchat/components/register.py | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/itchat/components/login.py b/itchat/components/login.py index bf8071a..e388296 100644 --- a/itchat/components/login.py +++ b/itchat/components/login.py @@ -27,7 +27,7 @@ def load_login(core): def login(self, enableCmdQR=False, picDir=None, qrCallback=None, loginCallback=None, exitCallback=None): if self.alive: - logger.debug('itchat has already logged in.') + logger.warning('itchat has already logged in.') return while 1: for getCount in range(10): @@ -175,7 +175,7 @@ def web_init(self): self.storageClass.nickName = dic['User']['NickName'] # deal with contact list returned when init contactList = dic.get('ContactList', []) - contactList.append(self.loginInfo['User']) + contactList.append(self.loginInfo['User']) # self contact should be added first chatroomList, otherList = [], [] for m in contactList: if m['Sex'] != 0: @@ -233,7 +233,7 @@ def start_receiving(self, exitCallback=None, getReceivingFnOnly=False): retryCount = 0 except: retryCount += 1 - logger.debug(traceback.format_exc()) + logger.error(traceback.format_exc()) if self.receivingRetryCount < retryCount: self.alive = False else: diff --git a/itchat/components/messages.py b/itchat/components/messages.py index ad4bbc1..518f550 100644 --- a/itchat/components/messages.py +++ b/itchat/components/messages.py @@ -180,7 +180,7 @@ def produce_msg(core, msgList): 'Type': 'Useless', 'Text': 'UselessMsg', } 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 = { 'Type': 'Useless', 'Text': 'UselessMsg', } diff --git a/itchat/components/register.py b/itchat/components/register.py index 47bd356..4cbec8a 100644 --- a/itchat/components/register.py +++ b/itchat/components/register.py @@ -66,6 +66,7 @@ def configured_reply(self): r = replyFn(msg) if r is not None: self.send(r, msg.get('FromUserName')) except: + logger.warning('An error occurred in registered function, use `itchat.run(debug=True)` to show detailed information') logger.debug(traceback.format_exc()) def msg_register(self, msgType, isFriendChat=False, isGroupChat=False, isMpChat=False): -- GitLab