add some debug messages

This commit is contained in:
Matias Alejo Garcia 2014-11-11 09:01:31 -03:00
commit e0969cd95c

View file

@ -47,7 +47,7 @@ InsightStorage.prototype.getItem = function(name, callback) {
var self = this; var self = this;
this._makeGetRequest(passphrase, name, function(err, body) { this._makeGetRequest(passphrase, name, function(err, body) {
console.log('[InsightStorage.js.49:err:]',err); //TODO if (err) log.info('[InsightStorage. err]', err);
if (err && err.indexOf('PNOTFOUND') !== -1 && mayBeOldPassword(self.password)) { if (err && err.indexOf('PNOTFOUND') !== -1 && mayBeOldPassword(self.password)) {
return self._brokenGetItem(name, callback); return self._brokenGetItem(name, callback);
} }
@ -77,15 +77,16 @@ InsightStorage.prototype.getPassphrase = function() {
InsightStorage.prototype._makeGetRequest = function(passphrase, key, callback) { InsightStorage.prototype._makeGetRequest = function(passphrase, key, callback) {
var authHeader = new buffers.Buffer(this.email + ':' + passphrase).toString('base64'); var authHeader = new buffers.Buffer(this.email + ':' + passphrase).toString('base64');
var retrieveUrl = this.storeUrl + '/retrieve'; var retrieveUrl = this.storeUrl + '/retrieve';
log.debug(retrieveUrl); var getParams = {
this.request.get({
url: retrieveUrl + '?' + querystring.encode({ url: retrieveUrl + '?' + querystring.encode({
key: key key: key
}), }),
headers: { headers: {
'Authorization': authHeader 'Authorization': authHeader
} }
}, };
log.debug('Insight request', getParams);
this.request.get(getParams,
function(err, response, body) { function(err, response, body) {
if (err) { if (err) {
return callback('Connection error'); return callback('Connection error');