From 926bd81edab999339d868c6bd9d83b114cef005a Mon Sep 17 00:00:00 2001 From: Javier Date: Wed, 20 Jan 2016 16:38:11 -0300 Subject: [PATCH] add log level debug --- lib/pushnotificationsservice.js | 9 ++++++--- pushnotificationsservice/pushnotificationsservice.js | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/pushnotificationsservice.js b/lib/pushnotificationsservice.js index 641cc92..a12724a 100644 --- a/lib/pushnotificationsservice.js +++ b/lib/pushnotificationsservice.js @@ -12,6 +12,7 @@ var Utils = require('./common/utils'); var Model = require('./model'); var log = require('npmlog'); log.debug = log.verbose; +log.level = 'debug'; var PUSHNOTIFICATIONS_TYPES = { 'NewCopayer': { @@ -97,10 +98,12 @@ PushNotificationsService.prototype._sendPushNotifications = function(notificatio var notifType = PUSHNOTIFICATIONS_TYPES[notification.type]; if (!notifType) return cb(); - // console.log(notification); + log.debug('\n### Notification received\n', JSON.stringify(notification)); self._checkShouldSendNotif(notification, function(err, should) { if (err) return cb(err); + + log.debug('\nShould send notification: ', should); if (!should) return cb(); self._getRecipientsList(notification, function(err, recipientsList) { @@ -133,8 +136,8 @@ PushNotificationsService.prototype._sendPushNotifications = function(notificatio async.each(optsList, function(opts, next) { self._makeRequest(opts, function(err, response) { - if (err) log.error(err); - log.debug('Post status : ', response); + if (err) log.error('ERROR!: ', err); + log.debug('Request status : ', response); next(); }); }, diff --git a/pushnotificationsservice/pushnotificationsservice.js b/pushnotificationsservice/pushnotificationsservice.js index b0acaeb..e336fca 100644 --- a/pushnotificationsservice/pushnotificationsservice.js +++ b/pushnotificationsservice/pushnotificationsservice.js @@ -4,6 +4,7 @@ var log = require('npmlog'); log.debug = log.verbose; +log.level = 'debug'; var config = require('../config'); var PushNotificationsService = require('../lib/pushnotificationsservice'); @@ -12,5 +13,5 @@ var pushNotificationsService = new PushNotificationsService(); pushNotificationsService.start(config, function(err) { if (err) throw err; - console.log('Push Notification Service started'); + log.debug('Push Notification Service started'); });