Browse Source

fix: add more log in itchat

master
lanvent 1 year ago
parent
commit
be258e5b05
2 changed files with 3 additions and 2 deletions
  1. +2
    -1
      lib/itchat/components/login.py
  2. +1
    -1
      lib/itchat/components/register.py

+ 2
- 1
lib/itchat/components/login.py View File

@@ -43,6 +43,7 @@ def login(self, enableCmdQR=False, picDir=None, qrCallback=None,
logger.warning('itchat has already logged in.') logger.warning('itchat has already logged in.')
return return
self.isLogging = True self.isLogging = True
logger.info('Ready to login.')
while self.isLogging: while self.isLogging:
uuid = push_login(self) uuid = push_login(self)
if uuid: if uuid:
@@ -84,7 +85,7 @@ def login(self, enableCmdQR=False, picDir=None, qrCallback=None,
if hasattr(loginCallback, '__call__'): if hasattr(loginCallback, '__call__'):
r = loginCallback() r = loginCallback()
else: else:
utils.clear_screen()
# utils.clear_screen()
if os.path.exists(picDir or config.DEFAULT_QR): if os.path.exists(picDir or config.DEFAULT_QR):
os.remove(picDir or config.DEFAULT_QR) os.remove(picDir or config.DEFAULT_QR)
logger.info('Login successfully as %s' % self.storageClass.nickName) logger.info('Login successfully as %s' % self.storageClass.nickName)


+ 1
- 1
lib/itchat/components/register.py View File

@@ -28,7 +28,7 @@ def auto_login(self, hotReload=False, statusStorageDir='itchat.pkl',
if rval:=self.load_login_status(statusStorageDir, if rval:=self.load_login_status(statusStorageDir,
loginCallback=loginCallback, exitCallback=exitCallback): loginCallback=loginCallback, exitCallback=exitCallback):
return return
logger.error('hot reload failed, logging in normally, {}'.format(rval))
logger.error('Hot reload failed, logging in normally, error={}'.format(rval))
self.logout() self.logout()
self.login(enableCmdQR=enableCmdQR, picDir=picDir, qrCallback=qrCallback, self.login(enableCmdQR=enableCmdQR, picDir=picDir, qrCallback=qrCallback,
loginCallback=loginCallback, exitCallback=exitCallback) loginCallback=loginCallback, exitCallback=exitCallback)


Loading…
Cancel
Save