Skip to content

Commit

Permalink
Logging improvements, fixed a regression
Browse files Browse the repository at this point in the history
  • Loading branch information
avivace committed Jun 3, 2017
1 parent e181226 commit 3da1987
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = {
// (privacy activated)
const chatId = msg.chat.id;
const message = msg.text;
console.log("---")
console.log("---".cyan.bold)
console.log(chatId + " : " + message)

if (!convStatusMap.get(chatId))
Expand Down Expand Up @@ -136,6 +136,8 @@ module.exports = {
console.log("Denied")
bot.sendMessage(chatId, whitelistDenyText + " chatId: " + chatId)
}
console.log("---".cyan.bold)
});

}
};
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var request = require('request'),
stripTags = require('striptags'),
colors = require('colors');

console.log('RSS Notifier started'.green); // outputs green text
console.log('RSS Notifier started'.green.bold); // outputs green text

// Element is in array helper function
var contains = function(needle) {
Expand Down Expand Up @@ -111,11 +111,11 @@ function getNewElements(url) {
}
}
else {
console.log("Initializing".inverse +" a new feed")
cachedFeeds.set(url, new Array());
Feed.forEach(function(post) {
cachedFeeds.get(url).push(post.title);
})
console.log("Initialized".inverse +" a new feed")
}

return newElements;
Expand Down Expand Up @@ -214,7 +214,7 @@ function fetch(url) {
var rq_Query_Params = [url, 1];
db.all(rq_Query, rq_Query_Params, function(error, rows) {
//console.log(rows)
console.log("Fetching " + url + " and checking " + rows.length.toString().inverse + " queries")
console.log("Fetching " + url.italic + " and checking " + rows.length.toString().inverse + " queries")

feeds.set(url, new Array());
feedparser.on('readable', function() {
Expand All @@ -234,7 +234,7 @@ function fetch(url) {
//console.log(newElements)
newElements.forEach(function(element){
rows.forEach(function(row) {
match(post, row.keywordGroup, row.Owner);
match(element, row.keywordGroup, row.Owner);
});
});
});
Expand Down

0 comments on commit 3da1987

Please sign in to comment.