Skip to content

Commit

Permalink
Clear useless loggings
Browse files Browse the repository at this point in the history
  • Loading branch information
littlecodersh committed Feb 8, 2017
1 parent 30eaebe commit 35bac6b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
1 change: 0 additions & 1 deletion itchat/components/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ def produce_group_chat(core, msg):
member = utils.search_dict_list((chatroom or {}).get(
'MemberList') or [], 'UserName', actualUserName)
if member is None:
print(chatroom['MemberList'])
logger.debug('chatroom member fetch failed with %s' % actualUserName)
else:
msg['ActualUserName'] = actualUserName
Expand Down
17 changes: 10 additions & 7 deletions itchat/components/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,16 @@ def configured_reply(self):
else:
try:
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:
logger.warning('An error occurred in registered function, use `itchat.run(debug=True)` to show detailed information')
logger.debug(traceback.format_exc())
logger.warning(traceback.format_exc())

def msg_register(self, msgType, isFriendChat=False, isGroupChat=False, isMpChat=False):
''' a decorator constructor
return a specific decorator based on information given '''
if not isinstance(msgType, list): msgType = [msgType]
if not isinstance(msgType, list):
msgType = [msgType]
def _msg_register(fn):
for _msgType in msgType:
if isFriendChat:
Expand All @@ -91,12 +92,14 @@ def run(self, debug=False, blockThread=True):
set_logging(loggingLevel=logging.DEBUG)
def reply_fn():
try:
while self.alive: self.configured_reply()
while self.alive:
self.configured_reply()
except KeyboardInterrupt:
if self.useHotReload: self.dump_login_status()
if self.useHotReload:
self.dump_login_status()
self.alive = False
logger.debug('itchat received an ^C and exit.')
print('Bye~')
logger.info('Bye~')
if blockThread:
reply_fn()
else:
Expand Down
2 changes: 1 addition & 1 deletion itchat/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os, platform

VERSION = '1.2.21'
VERSION = '1.2.22'
BASE_URL = 'https://login.weixin.qq.com'
OS = platform.system() #Windows, Linux, Darwin
DIR = os.getcwd()
Expand Down
2 changes: 1 addition & 1 deletion itchat/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def print_cmd_qr(fileDir, size = 37, padding = 3,
except ImportError:
def print_cmd_qr(fileDir, size = 37, padding = 3,
white = BLOCK, black = ' ', enableCmdQR = True):
print('pillow should be installed to use command line QRCode: pip install pillow')
logger.warning('pillow should be installed to use command line QRCode: pip install pillow')
print_qr(fileDir)
def struct_friend_info(knownInfo):
member = copy.deepcopy(friendInfoTemplate)
Expand Down

0 comments on commit 35bac6b

Please sign in to comment.