Skip to content

Commit

Permalink
Replaced debug by lambda-logs package
Browse files Browse the repository at this point in the history
  • Loading branch information
omenocal committed Jun 28, 2018
1 parent 867ffe4 commit 3f8325d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
10 changes: 5 additions & 5 deletions lib/Voxa-Dashbot.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const _ = require('lodash');
const DashbotAnalytics = require('dashbot');
const debug = require('debug')('voxa:dashbot');
const lambdaLog = require('lambda-log');

const defaultConfig = {
ignoreUsers: [],
Expand Down Expand Up @@ -30,26 +30,26 @@ function register(skill, config) {
if (pluginConfig.suppressSending) return Promise.resolve(null);
if (isSessionEndedRequest && request.request.type !== 'SessionEndedRequest') return Promise.resolve(null);

debug('Sending to dashbot');
lambdaLog.info('Sending to dashbot');

const newRequestObject = _.pick(request, ['version', 'session', 'context', 'request']);

// PROCESSING INCOMING RESPONSE
return Dashbot.logIncoming(newRequestObject)
.then(response => response.text())
.then((response) => {
debug('logIncoming response', response);
lambdaLog.info('logIncoming response', { response });

// PROCESSING OUTGOING RESPONSE
return Dashbot.logOutgoing(newRequestObject, reply.toJSON());
})
.then(response => response.text())
.then((response) => {
debug('logOutgoing response', response);
lambdaLog.info('logOutgoing response', { response });
return response;
})
.catch((err) => {
debug('err', err);
lambdaLog.error(err);
});
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"test": "istanbul cover _mocha -- --recursive tests",
"test-ci": "JUNIT_REPORT_PATH=junit.xml istanbul cover _mocha -- --recursive --colors --reporter mocha-jenkins-reporter tests",
"cobertura": "istanbul report cobertura --root coverage",
"lint": "eslint --fix lib/ tests/",
"lint-fix": "eslint lib/ tests/"
"lint": "eslint lib/ tests/",
"lint-fix": "eslint --fix lib/ tests/"
},
"repository": {
"type": "git",
Expand All @@ -32,7 +32,7 @@
"license": "MIT",
"dependencies": {
"dashbot": "^9.9.1",
"debug": "^2.6.9",
"lambda-log": "^1.4.0",
"lodash": "^4.17.10"
},
"devDependencies": {
Expand Down
2 changes: 0 additions & 2 deletions tests/voxa-dashbot.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ const voxaDashbot = require('../lib/Voxa-Dashbot');
const views = require('./views');
const version = require('../package').dependencies.dashbot.replace('^', '');

console.log('DASHBOT VERSION', version);

const expect = chai.expect;
const DASHBOT_URL = 'https://tracker.dashbot.io';
const dashbotConfig = {
Expand Down

0 comments on commit 3f8325d

Please sign in to comment.