use console.log

This commit is contained in:
Sacha Greif 2016-01-07 18:46:17 +01:00
parent 2d358a6de2
commit 3cc20e4c83
2 changed files with 15 additions and 11 deletions

View file

@ -241,8 +241,9 @@ Telescope.utils.checkNested = function(obj /*, level1, level2, ... levelN*/) {
};
Telescope.log = function (s) {
if(Settings.get('debug', false))
if(Settings.get('debug', false) || process.env.NODE_ENV === "development") {
console.log(s);
}
};
// see http://stackoverflow.com/questions/8051975/access-object-child-properties-using-a-dot-notation-string

View file

@ -75,18 +75,19 @@ var feedHandler = {
stream.pipe(feedParser);
feedParser.on('meta', Meteor.bindEnvironment(function(meta) {
Telescope.log('// Parsing RSS feed: '+ meta.title);
feedParser.on('meta', Meteor.bindEnvironment(function (meta) {
console.log('// Parsing RSS feed: '+ meta.title);
}));
feedParser.on('error', Meteor.bindEnvironment(function(error) {
Telescope.log(error);
feedParser.on('error', Meteor.bindEnvironment(function (error) {
console.log(error);
}));
feedParser.on('readable', Meteor.bindEnvironment(function() {
feedParser.on('readable', Meteor.bindEnvironment(function () {
var s = this, item;
while (item = s.read()) {
// if item has no guid, use the URL to give it one
if (!item.guid) {
item.guid = item.link;
@ -94,7 +95,7 @@ var feedHandler = {
// check if post already exists
if (!!Posts.findOne({feedItemId: item.guid})) {
Telescope.log('// Feed item already imported');
console.log('// Feed item already imported');
continue;
}
@ -129,13 +130,14 @@ var feedHandler = {
Posts.submit(post);
} catch (error) {
// catch errors so they don't stop the loop
Telescope.log(error);
console.log(error);
}
}
// Telescope.log('// Found ' + newItemsCount + ' new feed items');
}, function() {
Telescope.log('Failed to bind environment');
// console.log('// Found ' + newItemsCount + ' new feed items');
}, function (error) {
console.log('// Failed to bind environment');
console.log(error.stack)
}, feedParser));
}
};
@ -162,6 +164,7 @@ fetchFeeds = function() {
Meteor.methods({
fetchFeeds: function () {
console.log("// fetching feeds…");
fetchFeeds();
},
testEntities: function (text) {