From bfcda7cc028f30ea5aac539be0a86ae4600881c6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 29 Mar 2020 14:08:19 +0900 Subject: [PATCH] Better sql log --- src/db/postgre.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/db/postgre.ts b/src/db/postgre.ts index 57703fb095..9e3eb3f7d6 100644 --- a/src/db/postgre.ts +++ b/src/db/postgre.ts @@ -69,7 +69,9 @@ class MyCustomLogger implements Logger { } public logQuery(query: string, parameters?: any[]) { - sqlLogger.info(this.highlight(query)); + if (program.verbose) { + sqlLogger.info(this.highlight(query)); + } } public logQueryError(error: string, query: string, parameters?: any[]) { @@ -158,7 +160,7 @@ export function initDb(justBorrow = false, sync = false, forceRecreate = false) } catch (e) {} } - const log = program.verbose; + const log = process.env.NODE_ENV != 'production'; return createConnection({ type: 'postgres',