Skip to content

Commit

Permalink
Merge pull request bitpay#450 from tanojaja/fix/push-notifications-logs
Browse files Browse the repository at this point in the history
fix push notifications service logs
  • Loading branch information
isocolsky committed Feb 2, 2016
2 parents 0977c20 + e622e28 commit 9404dee
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/pushnotificationsservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ PushNotificationsService.prototype._sendPushNotifications = function(notificatio
var notifType = PUSHNOTIFICATIONS_TYPES[notification.type];
if (!notifType) return cb();

log.debug('\n### Notification received\n', JSON.stringify(notification));
log.debug('Notification received: ' + notification.type);
log.debug(JSON.stringify(notification));

self._checkShouldSendNotif(notification, function(err, should) {
if (err) return cb(err);

log.debug('\nShould send notification: ', should);
log.debug('Should send notification: ', should);
if (!should) return cb();

self._getRecipientsList(notification, function(err, recipientsList) {
Expand Down Expand Up @@ -137,8 +138,12 @@ PushNotificationsService.prototype._sendPushNotifications = function(notificatio
async.each(optsList,
function(opts, next) {
self._makeRequest(opts, function(err, response) {
if (err) log.error('ERROR!: ', err);
log.debug('Request status : ', response);
if (err) log.error(err);
if (response) {
log.debug('Request status: ', response.statusCode);
log.debug('Request message: ', response.statusMessage);
log.debug('Request body: ', response.request.body);
}
next();
});
},
Expand Down

0 comments on commit 9404dee

Please sign in to comment.