"use strict";

const config = require('config');

const rp = require('request-promise');

if(config.has("app.log_level") && (config.get("app.log_level") === "debug")){
    require("request-debug")(rp);
}

/**
 * make - execute request
 * @param task
 * @returns {LocalPromise}
 */
exports.make = function(task) {
    return rp(task);
};

"use strict";

const config = require('config');

const rp = require('request-promise');

const logLevel = config.get("app.log_level");

if(logLevel === "debug" || logLevel === "trace"){
    require("request-debug")(rp);
}

/**
 * make - execute request
 * @param task
 * @returns {LocalPromise}
 */
exports.make = function(task) {
    return rp(task);
};

Include request logging in to bebug and trace logging.