From 0b1aa3dd299db641df3d4c56c7ee56a187fc3ab3 Mon Sep 17 00:00:00 2001 From: Fabio Di Stasio Date: Mon, 18 Jul 2022 17:21:34 +0200 Subject: [PATCH] fix: console events disabled in production --- src/main/libs/AntaresCore.ts | 2 +- src/main/libs/clients/MySQLClient.ts | 2 +- src/main/libs/clients/PostgreSQLClient.ts | 2 +- src/main/libs/clients/SQLiteClient.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/libs/AntaresCore.ts b/src/main/libs/AntaresCore.ts index b7b34828..5d9379e2 100644 --- a/src/main/libs/AntaresCore.ts +++ b/src/main/libs/AntaresCore.ts @@ -9,7 +9,7 @@ const queryLogger = ({ sql, cUid }: {sql: string; cUid: string}) => { const escapedSql = sql.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '').replace(/\s\s+/g, ' '); const mainWindow = webContents.fromId(1); mainWindow.send('query-log', { cUid, sql: escapedSql, date: new Date() }); - console.log(escapedSql); + if (process.env.NODE_ENV === 'development') console.log(escapedSql); }; /** diff --git a/src/main/libs/clients/MySQLClient.ts b/src/main/libs/clients/MySQLClient.ts index d1836023..0aab8769 100644 --- a/src/main/libs/clients/MySQLClient.ts +++ b/src/main/libs/clients/MySQLClient.ts @@ -1536,7 +1536,7 @@ export class MySQLClient extends AntaresCore { } async raw (sql: string, args?: antares.QueryParams) { - if (process.env.NODE_ENV === 'development') this._logger({ cUid: this._cUid, sql }); + this._logger({ cUid: this._cUid, sql }); args = { nest: false, diff --git a/src/main/libs/clients/PostgreSQLClient.ts b/src/main/libs/clients/PostgreSQLClient.ts index 89c9dfe7..9331e2a3 100644 --- a/src/main/libs/clients/PostgreSQLClient.ts +++ b/src/main/libs/clients/PostgreSQLClient.ts @@ -1314,7 +1314,7 @@ export class PostgreSQLClient extends AntaresCore { } async raw (sql: string, args?: antares.QueryParams) { - if (process.env.NODE_ENV === 'development') this._logger({ cUid: this._cUid, sql }); + this._logger({ cUid: this._cUid, sql }); args = { nest: false, diff --git a/src/main/libs/clients/SQLiteClient.ts b/src/main/libs/clients/SQLiteClient.ts index 270dad11..d483e55e 100644 --- a/src/main/libs/clients/SQLiteClient.ts +++ b/src/main/libs/clients/SQLiteClient.ts @@ -586,7 +586,7 @@ export class SQLiteClient extends AntaresCore { } async raw (sql: string, args?: antares.QueryParams) { - if (process.env.NODE_ENV === 'development') this._logger({ cUid: this._cUid, sql });// TODO: replace BLOB content with a placeholder + this._logger({ cUid: this._cUid, sql });// TODO: replace BLOB content with a placeholder args = { nest: false,