Skip to content

Commit

Permalink
Logging: Introduced logging method for debugging
Browse files Browse the repository at this point in the history
 This commit fixes issue#52
  • Loading branch information
ananthanandanan committed May 20, 2020
1 parent 9e1fc89 commit 2bb43c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nawab_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,7 @@ def logger(self, msg, level, logfile):
log.warning(msg)
elif level == 'error':
log.error(msg)
elif level == 'debug':
log.debug(msg)
else:
print('Invalid message')
3 changes: 3 additions & 0 deletions twitter_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def isUserBanned(self, userName, admin_user):
def isSafeKeyword(self, tweetText):
### Search if tweettext is safe
if not any(word["Banwords"] == tweetText.lower() for index, word in self.data.iterrows()):
self.nw_logger.logger("\t|The keyword is safe: \n", 'debug', 'Error')
return True
return False

Expand All @@ -75,8 +76,10 @@ def nawab_get_id(self):
def nawab_check_tweet(self, tweet_id):
tid = pd.read_csv(self.dirpath + 'tid_store.csv')
if any(tid_store["Id"] == tweet_id for index, tid_store in tid.iterrows()):
self.nw_logger.logger("\t|No duplicate tweet spawned\n", 'debug', 'Error')
return True
else:
self.nw_logger.logger("\t| duplicate tweet spawned!! with id:" + tweet_id + "\n", 'debug', 'Error')
return False

def nawab_curate_list(self, api):
Expand Down

0 comments on commit 2bb43c5

Please sign in to comment.