Final cleanups I think

This commit is contained in:
rejas 2020-06-01 16:40:20 +02:00
parent 008ac2876b
commit 963b1aa6b1
4 changed files with 13 additions and 16 deletions

View File

@ -34,10 +34,10 @@ if (process.env.MM_PORT) {
// The next part is here to prevent a major exception when there
// is no internet connection. This could probable be solved better.
process.on("uncaughtException", function (err) {
Log.log("Whoops! There was an uncaught exception...");
Log.error("Whoops! There was an uncaught exception...");
Log.error(err);
Log.log("MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?");
Log.log("If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues");
Log.error("MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?");
Log.error("If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues");
});
/* App - The core app.

View File

@ -1,5 +1,6 @@
/* Magic Mirror
* Logger
* Log
*
* This logger is very simple, but needs to be extended.
* This system can eventually be used to push the log messages to an external target.
*

View File

@ -436,7 +436,7 @@ var CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEntr
* Broadcast the existing events.
*/
this.broadcastEvents = function () {
Log.info("Broadcasting " + events.length + " events.");
Log.info("Calendar-Fetcher: Broadcasting " + events.length + " events.");
eventsReceivedCallback(self);
};

View File

@ -35,7 +35,6 @@ var Fetcher = function (url, reloadInterval, encoding, logFeedWarnings) {
/* fetchNews()
* Request the new items.
*/
var fetchNews = function () {
clearTimeout(reloadTimer);
reloadTimer = null;
@ -60,16 +59,15 @@ var Fetcher = function (url, reloadInterval, encoding, logFeedWarnings) {
url: url
});
} else if (logFeedWarnings) {
console.log("Can't parse feed item:");
console.log(item);
console.log("Title: " + title);
console.log("Description: " + description);
console.log("Pubdate: " + pubdate);
Log.warn("Can't parse feed item:");
Log.warn(item);
Log.warn("Title: " + title);
Log.warn("Description: " + description);
Log.warn("Pubdate: " + pubdate);
}
});
parser.on("end", function () {
//console.log("end parsing - " + url);
self.broadcastItems();
scheduleTimer();
});
@ -94,9 +92,7 @@ var Fetcher = function (url, reloadInterval, encoding, logFeedWarnings) {
/* scheduleTimer()
* Schedule the timer for the next update.
*/
var scheduleTimer = function () {
//console.log('Schedule update timer.');
clearTimeout(reloadTimer);
reloadTimer = setTimeout(function () {
fetchNews();
@ -128,10 +124,10 @@ var Fetcher = function (url, reloadInterval, encoding, logFeedWarnings) {
*/
this.broadcastItems = function () {
if (items.length <= 0) {
//console.log('No items to broadcast yet.');
Log.info("Newsfeed-Fetcher: No items to broadcast yet.");
return;
}
Log.info("Broadcasting " + items.length + " items.");
Log.info("Newsfeed-Fetcher: Broadcasting " + items.length + " items.");
itemsReceivedCallback(self);
};