From 4d4c70f240df6baff741ef7bb6bf818f249f8c8d Mon Sep 17 00:00:00 2001 From: Justin Lambert Date: Mon, 7 May 2018 10:58:35 +1000 Subject: [PATCH] make logs tuneable --- lib/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 14519ed..4327433 100644 --- a/lib/index.js +++ b/lib/index.js @@ -3,6 +3,8 @@ const Pool = require("pg-pool"), let databaseUrl = process.env.DATABASE_URL +let logSql = process.env.LOG_SQL + if (!databaseUrl) { throw new Error("Environment variable is not set"); } @@ -25,7 +27,9 @@ let pool = new Pool(config); let query = (text, values_in) => { let values = values_in || []; - console.log("SQL: " + text + " with values " + values.join(",")); + if (logSql){ + console.log("SQL: " + text + " with values " + values.join(",")); + } return pool.query(text, values) };