From d6633ff2fa4a8106bef64202605bc0222b0f8017 Mon Sep 17 00:00:00 2001 From: Ilya Radchenko Date: Thu, 18 Feb 2016 08:48:45 -0500 Subject: [PATCH] Fix pretty print --- lib/routes/projects.js | 1 + lib/util/log.js | 6 +++--- lib/util/prettyPrint.js | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/routes/projects.js b/lib/routes/projects.js index 759b2e3..d56515d 100644 --- a/lib/routes/projects.js +++ b/lib/routes/projects.js @@ -110,6 +110,7 @@ module.exports = function (emitter) { var providerId = request.params.providerId var id = request.params.id var payload = request.payload + payload['project'] = id // TODO: check whether the project exists + check if the provider is associated with the project diff --git a/lib/util/log.js b/lib/util/log.js index 0aa4a95..101a8c4 100644 --- a/lib/util/log.js +++ b/lib/util/log.js @@ -4,15 +4,15 @@ var prettyPrint = require('./prettyPrint.js') module.exports = function (module) { var filename = module.id return { - info: function (msg, vars) { + info(msg, vars) { if (vars) winston.info('[' + filename + ']' + ': ' + msg, prettyPrint(vars)) else winston.info('[' + filename + ']' + ': ' + msg) }, - warn: function (msg, vars) { + warn(msg, vars) { if (vars) winston.warn('[' + filename + ']' + ': ' + msg, prettyPrint(vars)) else winston.warn('[' + filename + ']' + ': ' + msg) }, - debug: function (msg, vars) { + debug(msg, vars) { if (vars) winston.debug('[' + filename + ']' + ': ' + msg, prettyPrint(vars)) else winston.debug('[' + filename + ']' + ': ' + msg) } diff --git a/lib/util/prettyPrint.js b/lib/util/prettyPrint.js index d72559f..870bf54 100644 --- a/lib/util/prettyPrint.js +++ b/lib/util/prettyPrint.js @@ -1,5 +1,5 @@ var prettyJson = function (json) { - JSON.stringify(json, null, 2) + return JSON.stringify(json, null, 2) } module.exports = prettyJson