Merge pull request #448 from tanojaja/feat/pushNotifications-03
Add log level debug on push notifications service
This commit is contained in:
commit
5430b51472
|
@ -12,6 +12,7 @@ var Utils = require('./common/utils');
|
||||||
var Model = require('./model');
|
var Model = require('./model');
|
||||||
var log = require('npmlog');
|
var log = require('npmlog');
|
||||||
log.debug = log.verbose;
|
log.debug = log.verbose;
|
||||||
|
log.level = 'debug';
|
||||||
|
|
||||||
var PUSHNOTIFICATIONS_TYPES = {
|
var PUSHNOTIFICATIONS_TYPES = {
|
||||||
'NewCopayer': {
|
'NewCopayer': {
|
||||||
|
@ -97,10 +98,12 @@ PushNotificationsService.prototype._sendPushNotifications = function(notificatio
|
||||||
var notifType = PUSHNOTIFICATIONS_TYPES[notification.type];
|
var notifType = PUSHNOTIFICATIONS_TYPES[notification.type];
|
||||||
if (!notifType) return cb();
|
if (!notifType) return cb();
|
||||||
|
|
||||||
// console.log(notification);
|
log.debug('\n### Notification received\n', JSON.stringify(notification));
|
||||||
|
|
||||||
self._checkShouldSendNotif(notification, function(err, should) {
|
self._checkShouldSendNotif(notification, function(err, should) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
|
|
||||||
|
log.debug('\nShould send notification: ', should);
|
||||||
if (!should) return cb();
|
if (!should) return cb();
|
||||||
|
|
||||||
self._getRecipientsList(notification, function(err, recipientsList) {
|
self._getRecipientsList(notification, function(err, recipientsList) {
|
||||||
|
@ -133,8 +136,8 @@ PushNotificationsService.prototype._sendPushNotifications = function(notificatio
|
||||||
async.each(optsList,
|
async.each(optsList,
|
||||||
function(opts, next) {
|
function(opts, next) {
|
||||||
self._makeRequest(opts, function(err, response) {
|
self._makeRequest(opts, function(err, response) {
|
||||||
if (err) log.error(err);
|
if (err) log.error('ERROR!: ', err);
|
||||||
log.debug('Post status : ', response);
|
log.debug('Request status : ', response);
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
var log = require('npmlog');
|
var log = require('npmlog');
|
||||||
log.debug = log.verbose;
|
log.debug = log.verbose;
|
||||||
|
log.level = 'debug';
|
||||||
|
|
||||||
var config = require('../config');
|
var config = require('../config');
|
||||||
var PushNotificationsService = require('../lib/pushnotificationsservice');
|
var PushNotificationsService = require('../lib/pushnotificationsservice');
|
||||||
|
@ -12,5 +13,5 @@ var pushNotificationsService = new PushNotificationsService();
|
||||||
pushNotificationsService.start(config, function(err) {
|
pushNotificationsService.start(config, function(err) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
|
||||||
console.log('Push Notification Service started');
|
log.debug('Push Notification Service started');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue