Added verbose logging option (currently toggled with a message)
This commit is contained in:
parent
d130cecdca
commit
e1473e2114
|
@ -7,6 +7,8 @@ var FeedRead = require("feed-read"); //for rss feed reading
|
||||||
var BotConfig = require("./botConfig.json"); //bot config file containing bot token
|
var BotConfig = require("./botConfig.json"); //bot config file containing bot token
|
||||||
var Config = require("./config.json"); //config file containing other settings
|
var Config = require("./config.json"); //config file containing other settings
|
||||||
|
|
||||||
|
var verboseLogging = false;
|
||||||
|
|
||||||
//get a URL object from the feedUrl so we can examine it and check connectivity later
|
//get a URL object from the feedUrl so we can examine it and check connectivity later
|
||||||
var url = Url.parse(Config.feedUrl);
|
var url = Url.parse(Config.feedUrl);
|
||||||
|
|
||||||
|
@ -65,12 +67,17 @@ Dns.resolve("discordapp.com", function (err) {
|
||||||
cacheLink(url);
|
cacheLink(url);
|
||||||
return url;
|
return url;
|
||||||
});
|
});
|
||||||
|
} else if(message === "enableVerboseLogging"){
|
||||||
|
verboseLogging = true;
|
||||||
|
} else if(message === "disableVerboseLogging"){
|
||||||
|
verboseLogging = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function checkFeedAndPost() {
|
function checkFeedAndPost() {
|
||||||
|
if(verboseLogging) logEvent("Bot is currently " + (bot.connected ? "connected to" : "disconnected from") + " discord");
|
||||||
//check that we have an internet connection (well not exactly - check that we have a connection to the host of the feedUrl)
|
//check that we have an internet connection (well not exactly - check that we have a connection to the host of the feedUrl)
|
||||||
Dns.resolve(url.host, function (err) {
|
Dns.resolve(url.host, function (err) {
|
||||||
if (err) reportError("CONNECTION ERROR: Cannot resolve host (you are probably not connected to the internet). Details: " + (err.message || err));
|
if (err) reportError("CONNECTION ERROR: Cannot resolve host (you are probably not connected to the internet). Details: " + (err.message || err));
|
||||||
|
|
Loading…
Reference in New Issue