A little bit of additional logging

This commit is contained in:
martin 2016-08-21 11:30:49 +01:00
parent 802e205cd4
commit bac675edcd
2 changed files with 9 additions and 4 deletions

View File

@ -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);
});
};

View File

@ -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;
};