Skip to content

Commit f88bada

Browse files
Logging: Introduced logging method for debugging
This commit fixes issue#52
1 parent 935a658 commit f88bada

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

nawab_logger.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,7 @@ def logger(self, msg, level, logfile):
3939
log.warning(msg)
4040
elif level == 'error':
4141
log.error(msg)
42+
elif level == 'debug':
43+
log.debug(msg)
4244
else:
4345
print('Invalid message')

twitter_bot.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def isUserBanned(self, userName, admin_user):
6363
def isSafeKeyword(self, tweetText):
6464
### Search if tweettext is safe
6565
if not any(str(word["Banwords"]).lower() in tweetText.lower() for index, word in self.data.iterrows()):
66+
self.nw_logger.logger("\t|The keyword is safe: \n", 'debug', 'Error')
6667
return True
6768
return False
6869

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

8285
def nawab_curate_list(self, api):

0 commit comments

Comments
 (0)