diff --git a/lib/mqtt/mqttClient.js b/lib/mqtt/mqttClient.js index 2815ebe..b69cdb6 100644 --- a/lib/mqtt/mqttClient.js +++ b/lib/mqtt/mqttClient.js @@ -56,22 +56,22 @@ var doInsertEntry = (obj) => { dbSave.addNewEvent(obj) .then(function(d) { 'use strict'; - console.log('Finished - Raw',d); + logger.info('Finished - Raw',d); }) .catch(function(e) { 'use strict'; - console.error(e); + logger.error(e); }); dbSave.addProcessedEvent(obj) .then(function(d) { 'use strict'; - console.log('Finished - Processed',d); + logger.info('Finished - Processed',d); }) .catch(function(e) { 'use strict'; - console.error(e); + logger.error(e); }); }; diff --git a/lib/server/db-save.js b/lib/server/db-save.js index c128bc2..7df414b 100644 --- a/lib/server/db-save.js +++ b/lib/server/db-save.js @@ -17,6 +17,7 @@ module.exports = function(db) { return resolve('ok'); }) .catch((err)=> { + console.error(err); return reject(err); }); }); @@ -33,6 +34,7 @@ module.exports = function(db) { return resolve('ok'); }) .catch((err)=> { + console.error(err); return reject(err); }); }); @@ -54,6 +56,7 @@ module.exports = function(db) { return resolve({reply: 'raw event inserted'}); }) .catch((err)=> { + console.error(err); return reject(err); }); }); @@ -72,6 +75,7 @@ module.exports = function(db) { return resolve({reply: 'Processed event inserted'}); }) .catch((err)=> { + console.error(err); return reject(err); }); @@ -92,6 +96,7 @@ module.exports = function(db) { _obj.humid = (parseInt(_data[12] + _data[13] + _data[14] + _data[15] + _data[16], 10) / 10); _obj.noise = parseInt('0x' + ('0' + bytes[17]).substr(-2) + ('0' + bytes[18]).substr(-2)); _obj.binData = bytes; + console.log(_obj); return _obj; };