Skip to content

Commit 35bac6b

Browse files
committed
Clear useless loggings
1 parent 30eaebe commit 35bac6b

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

itchat/components/messages.py

-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ def produce_group_chat(core, msg):
207207
member = utils.search_dict_list((chatroom or {}).get(
208208
'MemberList') or [], 'UserName', actualUserName)
209209
if member is None:
210-
print(chatroom['MemberList'])
211210
logger.debug('chatroom member fetch failed with %s' % actualUserName)
212211
else:
213212
msg['ActualUserName'] = actualUserName

itchat/components/register.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,16 @@ def configured_reply(self):
6464
else:
6565
try:
6666
r = replyFn(msg)
67-
if r is not None: self.send(r, msg.get('FromUserName'))
67+
if r is not None:
68+
self.send(r, msg.get('FromUserName'))
6869
except:
69-
logger.warning('An error occurred in registered function, use `itchat.run(debug=True)` to show detailed information')
70-
logger.debug(traceback.format_exc())
70+
logger.warning(traceback.format_exc())
7171

7272
def msg_register(self, msgType, isFriendChat=False, isGroupChat=False, isMpChat=False):
7373
''' a decorator constructor
7474
return a specific decorator based on information given '''
75-
if not isinstance(msgType, list): msgType = [msgType]
75+
if not isinstance(msgType, list):
76+
msgType = [msgType]
7677
def _msg_register(fn):
7778
for _msgType in msgType:
7879
if isFriendChat:
@@ -91,12 +92,14 @@ def run(self, debug=False, blockThread=True):
9192
set_logging(loggingLevel=logging.DEBUG)
9293
def reply_fn():
9394
try:
94-
while self.alive: self.configured_reply()
95+
while self.alive:
96+
self.configured_reply()
9597
except KeyboardInterrupt:
96-
if self.useHotReload: self.dump_login_status()
98+
if self.useHotReload:
99+
self.dump_login_status()
97100
self.alive = False
98101
logger.debug('itchat received an ^C and exit.')
99-
print('Bye~')
102+
logger.info('Bye~')
100103
if blockThread:
101104
reply_fn()
102105
else:

itchat/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os, platform
22

3-
VERSION = '1.2.21'
3+
VERSION = '1.2.22'
44
BASE_URL = 'https://login.weixin.qq.com'
55
OS = platform.system() #Windows, Linux, Darwin
66
DIR = os.getcwd()

itchat/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def print_cmd_qr(fileDir, size = 37, padding = 3,
105105
except ImportError:
106106
def print_cmd_qr(fileDir, size = 37, padding = 3,
107107
white = BLOCK, black = ' ', enableCmdQR = True):
108-
print('pillow should be installed to use command line QRCode: pip install pillow')
108+
logger.warning('pillow should be installed to use command line QRCode: pip install pillow')
109109
print_qr(fileDir)
110110
def struct_friend_info(knownInfo):
111111
member = copy.deepcopy(friendInfoTemplate)

0 commit comments

Comments
 (0)