Skip to content

Commit

Permalink
Merge pull request #14 from brandsExclusive/make-logs-tuneable
Browse files Browse the repository at this point in the history
make logs tuneable
  • Loading branch information
mastfissh authored May 7, 2018
2 parents 0a26a86 + 4d4c70f commit 0eaa526
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand All @@ -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)
};

Expand Down

0 comments on commit 0eaa526

Please sign in to comment.